
Hello Dev’s
Today now In this example,I will show you how we can get today date records in laravel application. We can simply get to current date records in laravel 8 application.
So here I will give you simple and also a easy example of get today date records in laravel 8. So we can see bellow example in whereDate function is used.
Example 1 :-
/** * The attributes that are mass assignable. * * @var array */ public function data(Request $request) { $users = User::whereDate('created_at', Carbon::today())->get(); dd($users); }
Example 2 :-
/** * The attributes that are mass assignable. * * @var array */ public function data(Request $request) { $users = DB::table('users')->select(DB::raw('*')) ->whereRaw('Date(created_at) = CURDATE()')->get(); dd($users); }
Read Also : Laravel 8 Mobile Number Verification Tutorial
I hope it will help you. Also you can follow us on Facebook