Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/composer/laravel/helpers-1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
CalumTowers authored Feb 8, 2024
2 parents 31b8a72 + b07aae1 commit a72281c
Show file tree
Hide file tree
Showing 13 changed files with 473 additions and 384 deletions.
2 changes: 1 addition & 1 deletion app/Console/Commands/NetworkData/ProcessNetworkData.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ private function endExpiredPilotSessions($expiringPilots)
/**
* Retrieve and cache an airport from the database.
*
* @param $ident string
* @param $ident string
* @return mixed
*/
private function getAirport(string $ident)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
use App\Models\Atc\Endorsement;
use App\Models\Mship\Account;
use App\Models\Training\WaitingList\WaitingListFlag;
use App\Rules\HomeMemberId;
use Carbon\Carbon;
use Filament\Actions;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Resources\Pages\ViewRecord;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Support\Arr;

class ViewWaitingList extends ViewRecord
Expand Down Expand Up @@ -44,11 +44,22 @@ protected function getHeaderActions(): array
->form([
TextInput::make('account_id')
->label('Account CID')
->rules([new HomeMemberId, fn () => function ($attribute, $value, $fail) {
->rule(fn () => function ($attribute, $value, $fail) {
if ($this->record->accounts->contains('id', $value)) {
$fail('This account is already in this waiting list.');
}
}])
})
->rule(fn () => function ($attribute, $value, $fail) {
if ($this->record->home_members_only) {
try {
if (! Account::findOrFail($value)->primary_state->isDivision) {
$fail('The specified member is not a home UK member.');
}
} catch (ModelNotFoundException $e) {
$fail('The specified member was not found.');
}
}
})
->required(),
DatePicker::make('join_date')
->visible(fn () => auth()->user()->can('addAccountsAdmin', $this->record))
Expand Down
6 changes: 3 additions & 3 deletions app/Libraries/UKCP.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected function getAccountFor(Account $account)
}

/**
* @param $token object|string A token object or token ID string
* @param $token object|string A token object or token ID string
* @return false|string
*/
public static function getKeyForToken($token)
Expand All @@ -87,8 +87,8 @@ public static function getKeyForToken($token)
}

/**
* @param $tokenID string The full length token ID
* @param $account Account
* @param $tokenID string The full length token ID
* @param $account Account
* @return string
*/
public static function getPathForToken($tokenID, $account)
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Mship/Concerns/HasEmails.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function setEmail($primaryEmail)
/**
* Retrieve an email address for a given SSO service.
*
* @param $sso_account_id
* @param $sso_account_id
* @return string
*/
public function getEmailForService($ssoAccountId)
Expand Down
1 change: 1 addition & 0 deletions app/Models/Training/WaitingList.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ protected static function boot()
const ANY_FLAGS = 'any';

protected $casts = [
'home_members_only' => 'boolean',
'feature_toggles' => 'array',
'deleted_at' => 'datetime',
];
Expand Down
2 changes: 1 addition & 1 deletion app/Policies/Training/WaitingListPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function create(Account $account)
/**
* Returns if the account has permission for either the ID or department type for the given permission
*
* @param string|string[] $permissionTemplate Of sprintf format, e.g. "permsion.to.%s"
* @param string|string[] $permissionTemplate Of sprintf format, e.g. "permsion.to.%s"
* @return void
*/
private function checkHasPermissionForList(Account $account, WaitingList $waitingList, mixed $permissionTemplates): bool
Expand Down
23 changes: 0 additions & 23 deletions app/Rules/HomeMemberId.php

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"fakerphp/faker": "^1.9.1",
"filament/upgrade": "^3.0-stable",
"laracasts/generators": "^2.0",
"laravel/homestead": "^14.0.0",
"laravel/homestead": "^15.0.1",
"laravel/legacy-factories": "^1.1",
"laravel/pint": "^1.10",
"mockery/mockery": "1.6.*",
Expand Down
Loading

0 comments on commit a72281c

Please sign in to comment.