first(); abort_if(!$section, 404, 'Invalid access code'); abort_if(!$section->is_active, 404, 'Invalid access code'); abort_if($section->guest_access_level == 'NONE', 401, 'Invalid access code'); $patient = null; if($section->note){ $patient = $section->note->client; }else{ $patient = $section->client; } return view('app.guest.section', compact('patient','section', 'guestAccessCode')); } public function handout(Request $request, $handoutClientUid ) { $handoutClient = HandoutClient::where('uid', $handoutClientUid)->first(); abort_if((!$handoutClient || !$handoutClient->is_active), 404, 'Invalid access code'); $handout = Handout::where('id', $handoutClient->handout_id)->first(); abort_if((!$handout || !$handout->is_active), 404, 'Invalid access code'); return Response::download( $handout->pdf_file_path, $handout->internal_name . '.pdf', ['Content-Type: application/pdf'] ); } public function appointmentConfirmation(Request $request, $appointmentUid ) { $appointment = Appointment::where('uid', $appointmentUid)->first(); abort_if(!count($appointment->confirmationRequests), 404, 'No confirmation requests on this appointment.'); abort_if(!$appointment, 404, 'Invalid url'); abort_if($appointment->status == 'CANCELLED', 404, 'Appointment has been cancelled'); abort_if($appointment->status == 'COMPLETED', 404, 'Appointment has been completed'); abort_if($appointment->status == 'ABANDONED', 404, 'Appointment has been abandoned'); return view('app.guest.appointment-confirmation', compact('appointment')); } }