dimanche 5 mai 2019

Eloquent Date Query

I have a table (with soft delete) and it is a whats on table. There is a field which is just a date field with the start date.

What I am trying to do is use eloquent to get a list of what on today onwards, but my attempts throw an error:

$wo = App\WhatsOn::whereDate('startDate', '=>', date('Y-m-d') )->get();

The error I am getting is

Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=> ? and whatson.deleted_at is null' at line 1 (SQL: select * from whatson where date(startDate) => 2019-05-05 and whatson.deleted_at is null)

Help greatly appreciated!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire