Reputation: 115
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?
Upvotes: 2
Views: 73
Reputation: 8618
Try this
Salary::where([
['year', '=', date('Y')],
['month', '<', date('m')]
])
->orWhere('year', '<', date('Y'))
->get()
Upvotes: 4