Ejemplo n.º 1
0
 /**
  * VideosController constructor.
  */
 public function __construct()
 {
     $this->type = request()->has('type') ? request()->get('type') : 1;
     $this->categories = ['' => 'Select'] + VideoCategory::where('is_active', 1)->where('type', $this->type)->lists('title', 'id')->all();
 }
 /**
  * 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'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     try {
         $category = VideoCategory::findOrFail($id);
         $category->delete();
     } catch (ModelNotFoundException $ex) {
         Flash::error('No video category found' . $ex);
         return redirect()->route('categories.index');
     }
     Flash::success('Video category deleted successfully');
     return back();
 }