laravel查询中的错误查询表示

I have this code to get events which is in current year:

$year = "YEAR('".date('Y/m/d')."')";
$event = Event::where('date_start', $year);
var_dump($event->toSql());

But the query representation of the code is as follows:

"select * from `events` where `date_start` = ? and `events`.`deleted_at` is null"

Why is that? Where my mistake?

If you want to get the records with specific year in a datetime type field of MySQL, you can use Eloquent's whereYear():

$year = 2017;
$event = Event::whereYear('date_start', '=', $year)->get();

Or obviously $year = date("Y") if you want events from current year!