Laravel Eloquent whereDate() Query Example

Laravel whereDate function example; Through this tutorial, i am going to show you how to use whereDate() function with eloquent queries in laravel apps.

The whereDate method may be used to compare a column’s value against a date.

Example 1 – Laravel WhereDate()

Now, i am going to show you how to use whereDate() function with db::table() in laravel app; as follows:

$users = DB::table('users')
                ->whereDate('created_at', '2016-12-31')
                ->get();

Example 2 – Laravel WhereDate()

Next, i am going to show you how to use whereDate() function with model in laravel app; as follows:

$users = User::whereDate('created_at', '2016-12-31')
                ->get();

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *