Too few arguments to function App\Http\Controllers\AppointmentController::downloadPdf(), 0 passed in C:\xampp\htdocs\Appointment_Form\vendor\laravel\framework\src\Illuminate\Routing\Controller.php on line 54 and exactly 1 expected
public function downloadPdf(Request $request){
$selectedDate = $request->input('date'); //get it from the form
$dates = usersappointments::query()
->when($selectedDate, function ($query, $selectedDate) {
$query->where('date', $selectedDate);
})
->get()
->groupBy('date');
$pdf = PDF::loadView('Appointments.usersAppointmentsGroup', ['dates' => $dates]);
return $pdf->download('users-details.pdf');
}