Suppose I have a Salary model contains column of month and year I want to fetch data like
Salary::where((year==date('Y') && month<date('m')) || year<date('Y'))->get()
How can I get in laravel elequent?
Advertisement
Answer
Try this
Salary::where([ ['year', '=', date('Y')], ['month', '<', date('m')] ]) ->orWhere('year', '<', date('Y')) ->get()