@cyberace whereDate('birth_date', Carbon::today())
Feb 20, 2020
10
Level 1
How can I get the results of the upcoming month's birthdays in Laravel
I have this code but I can't query only birthday of today. What should I do if I need this query type?
public function birth(Request $request)
{
$today = Carbon::now()->format('Y-m-d');
$birthday = DB::table('customers')
->select('id_user','first_name','last_name','birth_date','open_user_date')
->where('birth_date',$today)
->get();
return view('reports/birth',compact('birthday','date','today','hbddate'));
}
Level 102
Ok I think I understand
whereDay('birth_date', Carbon::now())->whereMonth('birth_date', Carbon::now())
If you need to get the number of years you can easily use an accessor
Please or to participate in this conversation.