Пример #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $application = Application::create(['name' => 'Soda']);
     $application_url = ApplicationUrl::create(['application_id' => $application->id, 'domain' => 'soda.dev', 'folder' => '']);
     $user = User::create(['name' => 'admin', 'email' => '*****@*****.**', 'password' => \Hash::make('password')]);
     $role_global_admin = Role::create(['name' => 'global_admin', 'display_name' => 'Global Administrator', 'description' => 'User is the administrator of all applications', 'application_id' => $application->id]);
     $role_admin = Role::create(['name' => 'admin', 'display_name' => 'Administrator', 'description' => 'User is the administrator of a given application', 'application_id' => $application->id]);
     $role_user = Role::create(['name' => 'user', 'display_name' => 'User', 'description' => 'Standard user (authenticated)', 'application_id' => $application->id]);
     $role_guest = Role::create(['name' => 'guest', 'display_name' => 'Guest', 'description' => 'Unauthenticated user', 'application_id' => $application->id]);
     $basic_admin = Permission::create(['name' => 'basic-admin', 'display_name' => 'Basic Admin', 'description' => 'User can access basic admin features', 'section' => 'admin', 'application_id' => $application->id]);
     $manage_own_permissions = Permission::create(['name' => 'manage-own-permissions', 'display_name' => 'Manage own permissions', 'description' => 'User can manage own permissions', 'section' => 'admin', 'application_id' => $application->id]);
     $manage_permissions = Permission::create(['name' => 'manage-permissions', 'display_name' => 'Manage permissions', 'description' => 'User can manage permissions', 'section' => 'admin', 'application_id' => $application->id]);
     $manage_groups = Permission::create(['name' => 'manage-roles', 'display_name' => 'Manage roles', 'description' => 'User can manage roles', 'section' => 'admin', 'application_id' => $application->id]);
     $manage_users = Permission::create(['name' => 'manage-users', 'display_name' => 'Manage users', 'description' => 'User can manage users', 'section' => 'admin', 'application_id' => $application->id]);
     $user->applications()->attach($application);
     $role_global_admin->attachPermission($basic_admin);
     $role_global_admin->attachPermission($manage_own_permissions);
     $role_global_admin->attachPermission($manage_permissions);
     $role_global_admin->attachPermission($manage_groups);
     $role_global_admin->attachPermission($manage_users);
     $role_admin->attachPermission($basic_admin);
     $role_admin->attachPermission($manage_own_permissions);
     $role_admin->attachPermission($manage_permissions);
     $role_admin->attachPermission($manage_groups);
     $role_admin->attachPermission($manage_users);
     $user->attachRole($role_global_admin);
 }
Пример #2
0
 /**
  * Auto generated seed file
  *
  * @return void
  */
 public function run()
 {
     $application = Application::create(['name' => 'Soda CMS']);
     ApplicationUrl::create(['domain' => 'localhost:8000', 'application_id' => $application->id]);
 }