/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { if (Auth::check() && $this->rolechucnangs && $this->rolechucnangs->Xoa == 1) { $danhmucphonghop = Danhmucphonghop::findOrFail($id); $danhmucphonghop->delete(); return \Redirect::route('danhmucphonghop.index')->with('message', 'Xóa thành công!'); } else { return \Redirect::route('danhmucphonghop.index')->with('message-error', 'Không có quyền truy cập'); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { if (Auth::check() && $this->rolechucnangs && $this->rolechucnangs->Sua == 1) { $cuochop = Cuochop::findOrFail($id); $phonghops = Danhmucphonghop::all(); $canbogiaos = $users = User::whereNull('users.deleted_at')->where('role_id', '>=', '3')->get(); $nguoinhans = User::where('role_id', '>', 2)->orderBy('name', 'desc')->get(); $nguonphatsinhs = Danhmucnguonphatsinh::orderBy('name')->get(); $tinhtrangcongviecs = Tinhtrangcongviec::orderBy('name')->get(); $lanhdaos = Canbo::orderBy('name')->get(); $giaoviecs = ['canbogiaos' => $canbogiaos, 'nguoinhans' => $nguoinhans, 'nguonphatsinhs' => $nguonphatsinhs, 'tinhtrangcongviecs' => $tinhtrangcongviecs]; return view('cuochop.edit')->with(['cuochop' => $cuochop, 'giaoviecs' => $giaoviecs, 'lanhdaos' => $lanhdaos, 'phonghops' => $phonghops, 'menus' => $this->menus]); } else { return \Redirect::to('cuochop.index')->with('message-error', 'Không có quyền truy cập'); } }