}); Route::resource('note', 'NoteController', ['only' => 'store']); Route::bind('doctor', function ($id) { return App\Doctor::whereId($id)->first(); }); Route::resource('doctor', 'DoctorController'); Route::bind('user', function ($id) { return App\User::whereId($id)->first(); }); Route::resource('user', 'UserController'); Route::bind('location', function ($id) { return App\Location::whereId($id)->first(); }); Route::resource('location', 'LocationController'); Route::bind('timeslot', function ($id) { return App\Timeslot::whereId($id)->first(); }); Route::resource('timeslot', 'TimeslotController'); Route::get('{lead_id}/retrieve_notes', ['as' => 'retrieve_notes_by_lead', 'uses' => 'NoteController@retrieveNote']); //get available timeslot locations Route::get('timeslot/available/{location_id}/{day}', function ($location_id, $day) { $timeslots = array('00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00'); $selectedTimeslots = \App\Timeslot::where('location_id', $location_id)->where('day', $day)->lists('time')->toArray(); return array_diff($timeslots, $selectedTimeslots); }); Route::get('doctor/{doctor}/available-locations', function ($doctor) { return $doctor->locations; }); Route::get('timeslot/{location_id}/daysofweek', function ($location_id) { $daysOfWeek = \App\Timeslot::select('day')->where('location_id', $location_id)->groupBy('day')->lists('day')->toArray(); $fullDaysOfWeek = ["0", "1", "2", "3", "4", "5", "6"];