How To Get Last 30 Days Record In Laravel 8

select * from users where created_at > now() - INTERVAL 30 day;
select * from users where created_at > current_date - interval 30 day;
$date = \Carbon\Carbon::today()->subDays(30);
$users = User::where('created_at','>=',$date)->get();

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Websolutionstuff

Websolutionstuff

96 Followers

I am Laravel and PHP Developer. I have also Good Knowledge of JavaScript, jQuery, Bootstrap and REST API.