Site Admin
Site Admin Founder of MeaningArticles
293 Views

Laravel get today Date Record

Hello Dev.

In this example,i can learn you the way to get today date data in laravel. you may surely get to cutting-date records in laravel.

I provide you with simple and easy example of get today date record in laravel. you 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); 
}

i'm hoping it assist you to, thanks for visit my article if you like my article then proportion together with your friend and social platform.