Add setting for home airport restriction #104

This commit is contained in:
Nabeel Shahzad 2018-02-28 15:27:46 -06:00
parent e7868868c4
commit 3188f356eb
3 changed files with 12 additions and 4 deletions

View File

@ -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,

View File

@ -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;

View File

@ -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);