Add setting for home airport restriction #104
This commit is contained in:
@@ -190,7 +190,7 @@ class CreateSettingsTable extends Migration
|
|||||||
'description' => 'The length of a pilot\'s ID',
|
'description' => 'The length of a pilot\'s ID',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->addSetting('pilot.auto_accept', [
|
$this->addSetting('pilots.auto_accept', [
|
||||||
'name' => 'Auto Accept New Pilot',
|
'name' => 'Auto Accept New Pilot',
|
||||||
'group' => 'pilots',
|
'group' => 'pilots',
|
||||||
'value' => true,
|
'value' => true,
|
||||||
@@ -198,6 +198,14 @@ class CreateSettingsTable extends Migration
|
|||||||
'description' => 'Automatically accept a pilot when they register',
|
'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', [
|
$this->addSetting('pilots.only_flights_from_current', [
|
||||||
'name' => 'Flights from Current',
|
'name' => 'Flights from Current',
|
||||||
'group' => 'pilots',
|
'group' => 'pilots',
|
||||||
@@ -206,7 +214,7 @@ class CreateSettingsTable extends Migration
|
|||||||
'description' => 'Only show/allow flights from their current location',
|
'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',
|
'name' => 'Pilot to ON LEAVE days',
|
||||||
'group' => 'pilots',
|
'group' => 'pilots',
|
||||||
'value' => 30,
|
'value' => 30,
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class UserService extends BaseService
|
|||||||
public function createPilot(User $user, array $groups=null)
|
public function createPilot(User $user, array $groups=null)
|
||||||
{
|
{
|
||||||
# Determine if we want to auto accept
|
# Determine if we want to auto accept
|
||||||
if(setting('pilot.auto_accept') === true) {
|
if(setting('pilots.auto_accept') === true) {
|
||||||
$user->state = UserState::ACTIVE;
|
$user->state = UserState::ACTIVE;
|
||||||
} else {
|
} else {
|
||||||
$user->state = UserState::PENDING;
|
$user->state = UserState::PENDING;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class RegistrationTest extends TestCase
|
|||||||
|
|
||||||
$userSvc = app('App\Services\UserService');
|
$userSvc = app('App\Services\UserService');
|
||||||
|
|
||||||
setting('pilot.auto_accept', true);
|
setting('pilots.auto_accept', true);
|
||||||
|
|
||||||
$user = factory(App\Models\User::class)->create();
|
$user = factory(App\Models\User::class)->create();
|
||||||
$user = $userSvc->createPilot($user);
|
$user = $userSvc->createPilot($user);
|
||||||
|
|||||||
Reference in New Issue
Block a user