i dont see what's my problem here, im just trying to get the month and the year from a date column in my DB, i was already using this query and it was working and now its not i really dont understand. ( new to laravel)
heres my controller:
public function showMonth($month, $year)
{
$workers = WorkerSalarie::all();
$worker = WorkerSalarie::select('*')
->where('MONTH(date)','=',$month)
->where('YEAR(date)','=',$year)
->get();
return view('backoffice.dashboard.show', compact('month', 'year', 'workerss'));
}
and this is the error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'MONTH(date)' in 'where clause'
(SQL: select * from `worker_salaries` where `MONTH(date)` = 3 and
`YEAR(date)` = 2021)