public function run()
 {
     $user = App::make(Config::get('auth.model'));
     $superuser = $user->find($user->min($user['primaryKey']));
     $role = new Role();
     $role->name = 'SuperAdmin';
     $role->description = 'This role is for the main administrator of your site. They will be able to do absolutely everything. (This role cannot be edited.)';
     $role->save();
     $role = Role::find('SuperAdmin');
     $role->users()->attach($superuser);
     Role::create(['name' => 'Member', 'description' => 'Represents the baseline registered user. Customize permissions as best suits your site.']);
 }
Exemplo n.º 2
0
 public function prepare()
 {
     Session::start();
     $this->artisan('migrate', ['--path' => 'packages/genealabs/laravel-governor/database/migrations']);
     $this->artisan('migrate', ['--path' => 'database/secondaryMigrations']);
     $this->superAdminUser = factory(LaravelGovernorTests\User::class)->create();
     $this->artisan('db:seed', ['--class' => 'LaravelGovernorDatabaseSeeder']);
     $this->unauthorizedUser = factory(LaravelGovernorTests\User::class)->create();
     $this->superAdminUser->fill(['name' => 'Test User', 'first_name' => 'Test', 'last_name' => 'User', 'email' => '*****@*****.**', 'password' => 'test123$']);
     $this->superAdminUser->save();
     $this->rolePolicy = new RolePolicy();
     $this->entityPolicy = new EntityPolicy();
     $this->assignmentPolicy = new AssignmentPolicy();
     $this->superAdminRole = Role::find('SuperAdmin');
     $this->memberRole = Role::find('Member');
     $this->role = new Role();
     $this->entity = new Entity();
     $this->assignment = new Assignment();
     $this->memberUser = User::limit(2)->get()->last();
 }
Exemplo n.º 3
0
 /**
  * @param $name
  * @return mixed
  */
 public function destroy($name)
 {
     $role = Role::find($name);
     $this->authorize('remove', $role);
     $role->delete();
     return redirect()->route('genealabs.laravel-governor.roles.index');
 }