My database (MySQL) has a timestamp field for created_at.
I have two entries, with the timestamps as follows:
- 2017-12-12 18:25:00
- 2016-10-02 18:00:00
Today is 2016-10-19 (for future reference). If I use the following query, I get no results:
$job = $jobs->where('closing_at', '>=', 'NOW()')
->orderBy($sorter[0], $sorter[1])->paginate(24);
If I hardcode the date, I get the correct results, just the one future date:
$job = $jobs->where('closing_at', '>=', "2016-10-19 00:00:00")
->orderBy($sorter[0], $sorter[1])->paginate(24);
I'm assuming my error is in the use of NOW() with the Eloquent query builder but I can't figure out the correct way to use this is.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire