示例#1
0
 /**
  * Controller init.
  * @param Backend $backend
  * @param ViewFactory $view
  */
 public function init(Backend $backend, ViewFactory $view)
 {
     $backend->setActiveMenu('system.users');
     $view->composer($this->viewName('users.form'), function (View $view) {
         $view->with('groups', GroupModel::query()->get());
     });
 }
示例#2
0
 /**
  * Init controller.
  * @param Backend $backend
  * @param ViewFactory $view
  */
 public function init(Backend $backend, ViewFactory $view)
 {
     $backend->setActiveMenu('system.groups');
     $view->composer($this->viewName('groups.form'), function (View $view) use($backend) {
         $view->with('rules', $backend->getAclGroups());
     });
 }
示例#3
0
 /**
  * Define acl as gate permissions.
  *
  * @param Gate $gate
  * @param Backend $backend
  */
 public function boot(Gate $gate, Backend $backend)
 {
     $this->app->booted(function () use($gate, $backend) {
         foreach ($backend->getAllAcl() as $acl => $label) {
             $gate->define($acl, function ($user) use($acl) {
                 return $user instanceof User ? $user->hasAccess($acl) : false;
             });
         }
     });
 }