Add user setup to installer

This commit is contained in:
Nabeel Shahzad
2017-12-29 16:56:46 -06:00
parent 50da3a9e54
commit 7cd4bf5ffb
24 changed files with 28377 additions and 41 deletions

View File

@@ -16,10 +16,11 @@ class UserService extends BaseService
/**
* Register a pilot. Also attaches the initial roles
* required, and then triggers the UserRegistered event
* @param User $user
* @param User $user User model
* @param array $groups Additional groups to assign
* @return mixed
*/
public function createPilot(User $user)
public function createPilot(User $user, array $groups=null)
{
# Determine if we want to auto accept
if(setting('pilot.auto_accept') === true) {
@@ -34,6 +35,13 @@ class UserService extends BaseService
$role = Role::where('name', 'user')->first();
$user->attachRole($role);
if(!empty($groups) && \is_array($groups)) {
foreach ($groups as $group) {
$role = Role::where('name', $group)->first();
$user->attachRole($role);
}
}
# Let's check their rank and where they should start
$this->calculatePilotRank($user);