Reputation: 17
How to use whereMonth, whereDate in Eloquent ORM? (I know it can in DB query). Im using 5.4
Upvotes: 0
Views: 918
Reputation: 2398
You can use all the methods from DB query in Eloquent models, Check the following samples you can easily capture it. Both the samples, produce the same result
Using query builder
$users = DB::table('users')
->whereDate('created_at', '2016-12-31')
->get();
Using model
$users = Users::whereDate('created_at', '2016-12-31')
->get();
Upvotes: 2