middleware('auth'); $this->middleware('atleast:employee'); $this->middleware('permission:manage_cinemas')->only(['create', 'store', 'edit', 'update', 'destroy']); } public function showAllCinemas() { return view('manage.cinemas.index', ['title' => "Manage Cinemas", 'cinemas' => \App\Models\Cinema::all()]); } public function edit($id) { $c = \App\Models\Cinema::findOrfail($id); return view('manage.cinemas.cinema', ['title' => "Manage Cinema", 'cinema' => $c, 'rooms' => $c->rooms]); } public function createCinema() { return view('manage.cinemas.create', ['title' => "Create Cinema"]); } public function store() { $cinema = new \App\Models\Cinema(); $cinema->cinema_name = request('cinema_name'); $cinema->address_id = request('address_id'); $cinema->save(); return redirect()->route('manage.cinemas'); } public function show($id) { return view('main.cinemas.cinema', ['title' => "Edit Cinema", 'cinema' => \App\Models\Cinema::findOrfail($id)]); } public function update($id) { $cinema = \App\Models\Cinema::findOrfail($id); $cinema->cinema_name = request('cinema_name'); $cinema->address_id = request('address_id'); $cinema->save(); return redirect()->route('manage.cinemas'); } public function destroy($id) { $cinema = \App\Models\Cinema::findOrfail($id); $cinema->delete(); return redirect()->route('manage.cinemas'); } }