Esempio n. 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) {
         $roles = Role::all();
         $dois = Danhmucdoi::all();
         $phongs = Danhmucphong::all();
         $chucvus = Danhmucchucvu::get();
         $capbacs = Danhmuccapbac::get();
         $user = User::findOrFail($id);
         return view('user.edit')->with(array('menus' => $this->menus, 'roles' => $roles, 'user' => $user, 'dois' => $dois, 'phongs' => $phongs, 'chucvus' => $chucvus, 'capbacs' => $capbacs));
     } else {
         return \Redirect::route('user.index')->with('message-error', 'Không có quyền truy cập');
     }
 }
 public function showdoi()
 {
     //$id = \Input::get('id');
     $dois = Danhmucdoi::whereNull('danhmucdois.deleted_at')->get(array('id', 'name'));
     //var_dump($noinhancongvans);
     return response()->json($dois);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if (Auth::check() && $this->rolechucnangs && $this->rolechucnangs->Xoa == 1) {
         $danhmucdoi = Danhmucdoi::findOrFail($id);
         $danhmucdoi->delete();
         return \Redirect::route('danhmucdoi.index')->with('message', 'Xóa thành công!');
     } else {
         return \Redirect::route('danhmucdoi.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) {
         $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');
     }
 }