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');
     Role::find(1)->permissions()->attach($permissions);
 }
示例#2
0
 /**
  * Remove the specified role from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($id)
 {
     try {
         $this->roles->destroy($id);
         return $this->redirect('roles.index');
     } catch (ModelNotFoundException $e) {
         return $this->redirectNotFound();
     }
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $name = $this->ask('Name : ');
     $email = $this->ask('Email : ');
     $password = $this->secret('Password : '******'name', 'email', 'password'));
     $this->line('Select role:');
     foreach (Role::all() as $role) {
         $this->line($role->id . '. ' . $role->name);
     }
     $role = $this->ask("Role number : ");
     $user->addRole($role);
     $this->info("User [{$user->name}] created successfully.");
 }
示例#4
0
 public function compose($view)
 {
     $roles = Role::lists('name', 'id');
     $view->with(compact('roles'));
 }
示例#5
0
 public function run()
 {
     Role::create(['name' => 'Administrator', 'slug' => 'admin']);
     Role::create(['name' => 'User', 'slug' => 'user']);
 }