Пример #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $permissions = R::allPermissions();
     foreach ($permissions as $name => $display_name) {
         Permission::create(compact('name', 'display_name'));
     }
 }
Пример #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $rolesWithPermissions = R::rolesWithPermissions();
     foreach ($rolesWithPermissions as $roleName => $permissions) {
         $role = Role::whereName($roleName)->first();
         foreach ($permissions as $permissionName) {
             $permission = Permission::whereName($permissionName)->first();
             $role->assignPermission($permission);
         }
     }
 }