Answers for "eloquent fetch documents specific date"

0

eloquent fetch documents specific date

$users = User::whereMonth('created_at', date('m'))->get();
//or you could also just use $carbon = CarbonCarbon::now(); $carbon->month;
//select * from `users` where month(`created_at`) = "04"
$users = User::whereDay('created_at', date('d'))->get();
//or you could also just use $carbon = CarbonCarbon::now(); $carbon->day;
//select * from `users` where day(`created_at`) = "03"
$users = User::whereYear('created_at', date('Y'))->get();
//or you could also just use $carbon = CarbonCarbon::now(); $carbon->year;
//select * from `users` where year(`created_at`) = "2017"
Posted by: Guest on February-21-2022

Code answers related to "TypeScript"

Browse Popular Code Answers by Language