Ejemplo n.º 1
0
 public function run()
 {
     $permissions = array('Manage Users', 'Manage Articles', 'Manage Pages', 'Manage Categories', 'Manage Settings', 'Manage Roles', 'Manage Permissions');
     foreach ($permissions as $permission) {
         Permission::create(['name' => $permission, 'slug' => $permission, 'description' => $permission]);
     }
     $permissions = Permission::lists('id')->toArray();
     Role::find(1)->permissions()->attach($permissions);
 }
Ejemplo n.º 2
0
 /**
  * Register the permissions.
  *
  * @param array|null $permissions
  */
 public function registerPermissions(array $permissions = null)
 {
     $permissions = $permissions ?: Permission::lists('slug');
     foreach ($permissions as $permission) {
         $this->router->filter($permission, function () use($permission) {
             if (!$this->auth->user()->can($permission)) {
                 $this->forbidden();
             }
         });
     }
 }
Ejemplo n.º 3
0
 public function run()
 {
     DB::table('permissions')->delete();
     Permission::create(['name' => 'Access Administration area', 'slug' => 'access_admin', 'description' => '']);
 }