예제 #1
0
 /**
  * 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) {
         $noisoanthaos = Danhmucphong::get(array('id', 'name'));
         $nguoikys = Canbo::get(array('id', 'name'));
         $mucdichs = Danhmucmucdich::get(array('id', 'name'));
         $linhvucchuyendes = Linhvucchuyende::get(array('id', 'name'));
         $chuyendes = Danhmucchuyende::get(array('id', 'name'));
         $loaicongvans = Danhmucloaicongvan::get(array('id', 'name'));
         $hinhthucchuyens = Danhmuchinhthucchuyen::get(array('id', 'name'));
         $dokhans = Danhmucdokhan::get(array('id', 'name'));
         $domats = Danhmucdomat::get(array('id', 'name'));
         $noinhancongvans = Danhmucdonvi::all();
         $phongs = Danhmucphong::orderBy('name')->get();
         $dois = Danhmucdoi::orderBy('name')->get();
         $canbos = User::where('role_id', '>', 2)->orderBy('name')->get();
         $emails = Danhmucemail::orderBy('name')->get();
         $congvandi = Congvandi::findOrFail($id);
         return view('congvandi.edit')->with(array('congvandi' => $congvandi, 'loaicongvans' => $loaicongvans, 'hinhthucchuyens' => $hinhthucchuyens, 'domats' => $domats, 'dokhans' => $dokhans, 'menus' => $this->menus, 'noisoanthaos' => $noisoanthaos, 'nguoikys' => $nguoikys, 'mucdichs' => $mucdichs, 'linhvucchuyendes' => $linhvucchuyendes, 'chuyendes' => $chuyendes, 'phongs' => $phongs, 'dois' => $dois, 'canbos' => $canbos, 'emails' => $emails));
     } else {
         return \Redirect::route('congvandi.index')->with('message-error', 'Không có quyền truy cập');
     }
 }
예제 #2
0
 /**
  * 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) {
         $loaicongvans = Danhmucloaicongvan::get(array('id', 'name'));
         $capphathanhs = Danhmucnhomdonvi::get(array('id', 'name'));
         $noiphathanhs = Danhmucdonvi::get(array('id', 'name', 'danhmucnhomdonvi_id'));
         $mucdichs = Danhmucmucdich::get(array('id', 'name'));
         $linhvucchuyendes = Linhvucchuyende::get(array('id', 'name'));
         $chuyendes = Danhmucchuyende::get(array('id', 'name', 'linhvucchuyende_id'));
         $chutrixulys = Danhmucphong::get(array('id', 'name'));
         $phoihopxulys = Danhmucphong::get(array('id', 'name'));
         $canboxulys = Canbo::get(array('id', 'name'));
         $phongs = Danhmucphong::orderBy('name')->get();
         $dois = Danhmucdoi::orderBy('name')->get();
         $canbos = User::where('role_id', '>', 2)->orderBy('name')->get();
         $emails = Danhmucemail::orderBy('name')->get();
         $domats = Danhmucdomat::get(array('id', 'name'));
         $dokhans = Danhmucdokhan::get(array('id', 'name'));
         $congvanden = Congvanden::findOrFail($id);
         if ($congvanden->sohosoluubo) {
             $action = 'congvanden.update';
             $title = 'bộ';
         } else {
             $action = 'congvanden.update';
             $title = '';
         }
         $getfiletralois = \DB::table('file_traloicongvandens')->where('congvanden_id', $id)->get();
         $getcountups = \DB::table('file_traloicongvandens')->where('congvanden_id', $id)->distinct()->select('stt')->get();
         $getusers = \DB::table('file_traloicongvandens')->where('congvanden_id', $id)->distinct()->select('user_id')->get();
         return view('congvanden.edit')->with(array('congvanden' => $congvanden, 'getcountups' => $getcountups, 'getfiletralois' => $getfiletralois, 'getusers' => $getusers, 'loaicongvans' => $loaicongvans, 'domats' => $domats, 'dokhans' => $dokhans, 'menus' => $this->menus, 'capphathanhs' => $capphathanhs, 'noiphathanhs' => $noiphathanhs, 'mucdichs' => $mucdichs, 'linhvucchuyendes' => $linhvucchuyendes, 'chuyendes' => $chuyendes, 'chutrixulys' => $chutrixulys, 'phoihopxulys' => $phoihopxulys, 'canboxulys' => $canboxulys, 'phongs' => $phongs, 'dois' => $dois, 'canbos' => $canbos, 'emails' => $emails, 'action' => $action, 'title' => $title));
     } else {
         return \Redirect::route('congvanden.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) {
         $danhmucdokhan = Danhmucdokhan::findOrFail($id);
         $danhmucdokhan->delete();
         return \Redirect::route('danhmucdokhan.index')->with('message', 'Xóa Thành Công!');
     } else {
         return \Redirect::route('danhmucdokhan.index')->with('message-error', 'Không có quyền truy cập');
     }
 }