/** * Display a listing of the resource. * * @return Response */ public function index() { $allAppointments = \App\Appointment::orderBy('id', 'ASC')->get(); return response()->view('appointment.index', array('apts' => $allAppointments)); }
public static function getAppointmentDoctor($doctor_id) { // $doctor_id = $doctor->input('doctor_id'); if ($doctor_id == null) { return ["success" => false, "message" => 'doctor_not_found']; } $appointments = Appointment::orderBy('time', 'desc')->where('emp_id', $doctor_id)->get(); $result = []; foreach ($appointments as $appointment) { $patient = Patient::where('id', $appointment->patient_id)->first(); $result[] = ["patient" => $patient, "appointment" => $appointment]; } if (sizeof($appointments) > 0) { return $result; } else { return []; } }