How to Get Today Date Records in Laravel 8?

Share Me
  •  
  •  
  •  
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share
How to Get Today Date Records in Laravel 8

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

About code chef

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by code chef →