public function doctorToday(Request $request){
$doctors = Appointment::with('doctor')->whereDate('date',date('Y-m-d'))->get();
return $doctors;
May I know how to implement one more day to the code? I want to get the tommorow's date instead of today's.
I would suggest using Carbon instead of date()
.
public function doctorToday(Request $request){
$doctors = Appointment::with('doctor')->whereDate('date',Carbon::now()->addDay()->format('Y-m-d'))->get();
return $doctors;
don't forget to add the use statement at the start of the class:
use Illuminate\Support\Carbon;