/** * 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) { $congviec = Congviec::findOrFail($id); $nguoinhans = User::where('role_id', '>', 2)->orderBy('name', 'desc')->get(); $nguonphatsinhs = Danhmucnguonphatsinh::orderBy('name')->get(); $tinhtrangcongviecs = Tinhtrangcongviec::orderBy('name')->get(); $canbogiaos = $users = User::whereNull('users.deleted_at')->where('role_id', '>=', '3')->get(); $getfiletralois = \DB::table('file_traloicongviecs')->where('congviec_id', $id)->get(); $getcountups = \DB::table('file_traloicongviecs')->where('congviec_id', $id)->distinct()->select('stt')->get(); $getusers = \DB::table('file_traloicongviecs')->where('congviec_id', $id)->distinct()->select('user_id')->get(); return view('congviec.edit')->with(array('congviec' => $congviec, 'tinhtrangcongviecs' => $tinhtrangcongviecs, 'nguonphatsinhs' => $nguonphatsinhs, 'nguoinhans' => $nguoinhans, 'canbogiaos' => $canbogiaos, 'getcountups' => $getcountups, 'getfiletralois' => $getfiletralois, 'getusers' => $getusers, 'menus' => $this->menus)); } else { return \Redirect::route('congviec.index')->with('message-error', 'Không có quyền truy cập'); } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { if (Auth::check() && $this->rolechucnangs && $this->rolechucnangs->Xoa == 1) { $danhmucnguonphatsinh = Danhmucnguonphatsinh::findOrFail($id); $danhmucnguonphatsinh->delete(); return \Redirect::route('danhmucnguonphatsinh.index')->with('message', 'Xóa Thành Công!'); } else { return \Redirect::route('danhmucnguonphatsinh.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'); } }