Пример #1
0
 public static function getnamebyroutename($routename)
 {
     $pattert = "/\\.[a-z]*\$/";
     $routename = preg_replace($pattert, '', $routename);
     $tenchucnang = Danhmucchucnang::where('chucnang_id', $routename)->value('tenchucnang');
     return $tenchucnang;
 }
Пример #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) {
         $roles = Role::all();
         $chucnangs = Danhmucchucnang::orderBy('orders')->get();
         $rolechucnangs = RoleChucnang::where('role_id', $id)->get();
         $role = Role::findOrFail($id);
         //echo '<pre>';
         //print_r($rolechucnangs);
         return view('role.edit')->with(array('menus' => $this->menus, 'roles' => $roles, 'role' => $role, 'chucnangs' => $chucnangs, 'rolechucnangs' => $rolechucnangs));
     } else {
         return \Redirect::route('role.index')->with('message-error', 'Không có quyền truy cập');
     }
 }
Пример #3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $menu = Danhmucchucnang::findOrFail($id);
     $menu->delete();
     return \Redirect::route('menu.index')->with('message', 'Xóa Thành Công!');
 }