Reputation: 2540
$dt = \Carbon::now();
$tomorrow = Carbon::tomorrow();
$yesterday = Carbon::yesterday();
$data = $this->model->select('id', 'description')
->whereBetween($dt, array($yesterday, $tomorrow))->get();
It is returning an error saying "An error occurred in database operation."
Upvotes: 0
Views: 40
Reputation: 86
In the wherebetween
clause the first argument should be table column field, which you are trying to compare.
For example:
$data = $this->model->select('id', 'description')
->whereBetween('created_date', array($yesterday, $tomorrow))->get();
Upvotes: 1