jeudi 30 novembre 2017

December month date query not working in Laravel

Very bizarre one here, I have a controller doing a date search for the current month - December in this case.

I have two dates for the range of December - I'm using created_at >= date(2017-12-01) and created_at < date(2018-01-01).

In Laravel the query it is not returning any results at all even though a) I'm expecting some records, and b) mysql query select * from redemptions where created_at >= date('2017-12-01') and created_at < date('2018-01-01') order by created_at desc, gives me the results I expect.

In the controller I have verified via dd that both the dates are as above and the sql dump is correct: select * from redemptions where created_at >= ? and created_at < ? order by created_at desc.

Hope I'm not missing something obvious :)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire