public function group(PermissionsGroup $group)
 {
     $this->authorize(PermissionsPolicy::PERMISSION_LIST);
     $groupId = $group->id ? $group->id : 0;
     $permissions = $this->permission->where('group_id', $groupId)->with('group', 'roles')->paginate($this->perPage);
     $groupName = $groupId == 0 ? 'Custom' : $group->name;
     $this->setTitle($title = "List of permissions - {$groupName}");
     $this->addBreadcrumbRoute('List of permissions', 'admin::auth.permissions.index');
     $this->addBreadcrumb($groupName);
     return $this->view('admin.permissions.list', compact('permissions'));
 }
 /**
  * Compose the view.
  *
  * @param  \Illuminate\Contracts\View\View  $view
  */
 public function composeFilters(View $view)
 {
     $filters = collect();
     // Permission groups
     //----------------------------------
     $groups = $this->cacheResults('permissions-groups.filters', function () {
         return PermissionsGroup::has('permissions')->get();
     });
     foreach ($groups as $group) {
         /** @var  \Arcanesoft\Auth\Models\PermissionsGroup  $group */
         $filters->put($group->slug, link_to_route('auth::foundation.permissions.group', $group->name, [$group->hashed_id]));
     }
     // Custom Permission group
     //----------------------------------
     if (Permission::where('group_id', 0)->count()) {
         $filters->put('custom', link_to_route('auth::foundation.permissions.group', 'Custom', [hasher()->encode(0)]));
     }
     $view->with('groupFilters', $filters->toArray());
     // TODO: return a collection instead of simple array
 }