$dt = \Carbon::now();
$tomorrow = Carbon::tomorrow();
$yesterday = Carbon::yesterday();
$data = $this->model->select('id', 'description')
->whereBetween($dt, array($yesterday, $tomorrow))->get();
它返回错误“数据库操作中发生错误。”
答案 0 :(得分:0)
在wherebetween
子句中,第一个参数应该是表列字段,您要对其进行比较。
例如:
$data = $this->model->select('id', 'description')
->whereBetween('created_date', array($yesterday, $tomorrow))->get();