/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $type = $this->type; try { $categories = VideoCategory::where('type', $type)->paginate(env('LIMIT', 15)); $category = VideoCategory::findOrFail($id); } catch (ModelNotFoundException $ex) { Flash::error('No video category found' . $ex); return redirect()->route('categories.index'); } return view('categories.index', compact('category', 'categories', 'type')); }
public function __construct() { $this->schools = ['' => 'Select'] + School::where('is_active', 1)->lists('name', 'id')->all(); $this->categories = ['' => 'Select'] + VideoCategory::where('is_active', 1)->where('type', 2)->lists('title', 'id')->all(); }
/** * 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(); }