/**
  * @param string $order_by
  * @param string $sort
  * @param bool $withRoles
  * @return mixed
  */
 public function getAllPermissions($order_by = 'id', $sort = 'asc', $withRoles = true)
 {
     if ($withRoles) {
         return Permission::with('roles')->orderBy($order_by, $sort)->get();
     }
     return Permission::orderBy($order_by, $sort)->get();
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $this->authorize('roles-edit');
     $role = Role::with('permissions')->findOrFail($id);
     $permissions = Permission::orderBy('display_name')->get();
     return view('roles.edit', compact('permissions', 'role'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $menus = Menu::all();
     $permissions = Permission::orderBy('updated_at', 'desc')->get();
     //echo '<pre>';
     //print_r($permissions);
     return view('permission.index')->with(array('menus' => $this->menus, 'permissions' => $permissions));
 }
Example #4
0
 public function role()
 {
     $roles = Role::with('perms')->get();
     $perms = Permission::orderBy('name')->get();
     $roles_json = $roles->toArray();
     $data = compact('roles', 'perms', 'roles_json');
     // dd($data);
     return view('user.role', $data);
 }
 public function getSorted()
 {
     $permissions = Permission::orderBy('name')->get();
     $sorted = [];
     foreach ($permissions as $permission) {
         $modelname = substr($permission->name, 0, strrpos($permission->name, '_'));
         if (!array_key_exists($modelname, $sorted)) {
             $sorted[$modelname] = [];
         }
         array_push($sorted[$modelname], ['name' => $permission->name, 'id' => $permission->id, 'label' => substr($permission->name, strrpos($permission->name, '_') + 1)]);
     }
     return $sorted;
 }
 public static function getAllPermissionsPaginated($pages)
 {
     return Permission::orderBy("permission_name", "ASC")->paginate($pages);
 }
 public function orderBy($column)
 {
     return \App\Permission::orderBy($column)->get();
 }
Example #8
0
 /**
  * permission list
  * @return view
  */
 public function index()
 {
     $list = Permission::orderBy('id', 'desc')->paginate(config('shop.pagesize'));
     return view('admin.permission.index', compact('list'));
 }
Example #9
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $user = $this->user->find($id);
     $branch = $this->branch->where('id', '!=', 1)->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account'))->orderBy('name', 'asc')->lists('name', 'id');
     $perms = Permission::orderBy('name', 'asc')->lists('display_name', 'id');
     return view('user.edit', compact('user', 'branch', 'perms'));
 }