jeudi 29 novembre 2018

Laravel cast datetime to date

Good Day everyone,

I'm doing a whereBetween dates query on eloquent however, I have issue with the date time.

if I select date_from to 2018-11-01 and date_to to 2018-11-29

and If i have a data that was created on 2018-11-29 12:28:45 the data created on this datetime will not be included because of the time. is there a way to cast the created_at to date.

here's my code:

Payable::with('details', 'transaction_type')
                        ->whereBetween('created_at', [$request->date_from, $request->date_to])
                        ->get();

thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire