Пример #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');
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if (Auth::check() && $this->rolechucnangs && $this->rolechucnangs->Xoa == 1) {
         $danhmuccapbac = Danhmuccapbac::findOrFail($id);
         $danhmuccapbac->delete();
         return \Redirect::route('danhmuccapbac.index')->with('message', 'Xóa Thành Công!');
     } else {
         return \Redirect::route('danhmuccapbac.index');
     }
 }