diff --git a/app/Database/migrations/2017_06_07_014930_create_settings_table.php b/app/Database/migrations/2017_06_07_014930_create_settings_table.php index ce4a793f..96a0c22a 100644 --- a/app/Database/migrations/2017_06_07_014930_create_settings_table.php +++ b/app/Database/migrations/2017_06_07_014930_create_settings_table.php @@ -190,7 +190,7 @@ class CreateSettingsTable extends Migration 'description' => 'The length of a pilot\'s ID', ]); - $this->addSetting('pilot.auto_accept', [ + $this->addSetting('pilots.auto_accept', [ 'name' => 'Auto Accept New Pilot', 'group' => 'pilots', 'value' => true, @@ -198,6 +198,14 @@ class CreateSettingsTable extends Migration 'description' => 'Automatically accept a pilot when they register', ]); + $this->addSetting('pilots.home_hubs_only', [ + 'name' => 'Hubs as home airport', + 'group' => 'pilots', + 'value' => false, + 'type' => 'boolean', + 'description' => 'Pilots can only select hubs as their home airport', + ]); + $this->addSetting('pilots.only_flights_from_current', [ 'name' => 'Flights from Current', 'group' => 'pilots', @@ -206,7 +214,7 @@ class CreateSettingsTable extends Migration 'description' => 'Only show/allow flights from their current location', ]); - $this->addSetting('pilot.auto_leave_days', [ + $this->addSetting('pilots.auto_leave_days', [ 'name' => 'Pilot to ON LEAVE days', 'group' => 'pilots', 'value' => 30, diff --git a/app/Services/UserService.php b/app/Services/UserService.php index 61d3bb9b..9671fd4a 100644 --- a/app/Services/UserService.php +++ b/app/Services/UserService.php @@ -43,7 +43,7 @@ class UserService extends BaseService public function createPilot(User $user, array $groups=null) { # Determine if we want to auto accept - if(setting('pilot.auto_accept') === true) { + if(setting('pilots.auto_accept') === true) { $user->state = UserState::ACTIVE; } else { $user->state = UserState::PENDING; diff --git a/tests/RegistrationTest.php b/tests/RegistrationTest.php index 0a90320b..5a8e4ccc 100644 --- a/tests/RegistrationTest.php +++ b/tests/RegistrationTest.php @@ -17,7 +17,7 @@ class RegistrationTest extends TestCase $userSvc = app('App\Services\UserService'); - setting('pilot.auto_accept', true); + setting('pilots.auto_accept', true); $user = factory(App\Models\User::class)->create(); $user = $userSvc->createPilot($user);