/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $schools = $this->schools; $categories = $this->categories; $colors = VideoCategory::lists('color', 'id')->toJson(); try { $schedule = WorkoutSchedule::findOrFail($id); } catch (ModelNotFoundException $ex) { Flash::error('No schedule available' . $ex); return redirect()->route('schedules.index'); } return view('schedules.edit', compact('schedule', 'schools', 'categories', 'colors')); }