Can someone tell me why im getting this error and how to fix it please.
$lastDayPreviousMonth = date("Y-m-d", strtotime("last day of previous month"));
$firstDayPreviousMonth = date("Y-m-d", strtotime("first day of previous month"));
$query = DB::table('employees')
->where('Emp_ClientId', '=', $clientId)
->where('Emp_StatusId', 1)
->orWhere(function ($query, $firstDayPreviousMonth, $lastDayPreviousMonth){
$query->where('Emp_DateSuspTerm', '>=', $firstDayPreviousMonth)
->where('Emp_DateSuspTerm', '<=', $lastDayPreviousMonth)
->where('Emp_ClientId', '=', $clientId);
})
->count();
Im getting the following error when i run this
Missing argument 2 for App\Http\Models\Employees::App\Http\Models{closure}()
I think it has to do with the firstdaypreviousmonth and lastdaypreviousmonth parameters im passing into the orWhere clause - if i take it out i get undefined variable.