appointmentRepository = new AppointmentRepository; } /** * Display a listing of the resource. */ public function index(Request $request) { $perPage = $request->has('per-page') ? $request->input('per-page') : null; $filter = $request->has('filter') ? $request->input('filter') : []; $data['appointments'] = $this->appointmentRepository->allAppointmentList($perPage, $filter); $data['appointmentCount'] = $data['appointments']->count(); return view('appointment::index', $data); } /** * Show the form for creating a new resource. */ public function create() { return view('appointment::create'); } /** * Store a newly created resource in storage. */ public function store(CreateAppointmentRequest $request): RedirectResponse { try { $validated = $request->validated(); $this->appointmentRepository->storeAppointmentList($validated); return redirect("/thankyou")->with('success','Message Sent Successfully'); } catch (\Throwable $th) { report($th); toastr()->error('Something went wrong.'); return back(); } } /** * Show the specified resource. */ public function show($uuid) { $data['appointment'] = $this->appointmentRepository->findAppointmentListById($uuid); return view('appointment::show', $data); } /** * Show the form for editing the specified resource. */ public function edit($id) { return view('appointment::edit'); } /** * Update the specified resource in storage. */ public function update(Request $request, $id): RedirectResponse { // } /** * Remove the specified resource from storage. */ public function destroy($uuid) { try { $appointment = $this->appointmentRepository->deleteAppointmentList($uuid); if (!$appointment) { toastr()->error('Appointment not found.'); return back(); } toastr()->success('Appointment deleted successfully.'); return redirect()->route('cms.appointment.index'); } catch (\Throwable $th) { report($th); toastr()->error('Something went wrong.'); return back(); } } }