[8.x] feature: upgrade to Laravel 13 (#2204)
* upgrade to laravel 13 * phpstan * rollback to symfony 7.4 * fix: ModuleService merge * refactor: new rector rules
This commit is contained in:
parent
e9c67b491c
commit
992b6d343a
@ -15,6 +15,7 @@ class LoadConfiguration extends \Illuminate\Foundation\Bootstrap\LoadConfigurati
|
|||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
#[\Override]
|
||||||
protected function loadConfigurationFiles(Application $app, RepositoryContract $repository)
|
protected function loadConfigurationFiles(Application $app, RepositoryContract $repository)
|
||||||
{
|
{
|
||||||
parent::loadConfigurationFiles($app, $repository);
|
parent::loadConfigurationFiles($app, $repository);
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Casts;
|
namespace App\Casts;
|
||||||
|
|
||||||
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||||
@ -16,11 +18,11 @@ class CommaDelimitedCast implements CastsAttributes
|
|||||||
*/
|
*/
|
||||||
public function get($model, string $key, $value, array $attributes)
|
public function get($model, string $key, $value, array $attributes)
|
||||||
{
|
{
|
||||||
if (empty($value) || in_array(trim($value), ['', '0'], true)) {
|
if (empty($value) || in_array(trim((string) $value), ['', '0'], true)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return explode(',', $value);
|
return explode(',', (string) $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -36,6 +38,6 @@ class CommaDelimitedCast implements CastsAttributes
|
|||||||
return implode(',', $value);
|
return implode(',', $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return trim($value);
|
return trim((string) $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,8 +25,8 @@ class DistanceCast implements CastsAttributes
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
return new Distance($value, config('phpvms.internal_units.distance'));
|
return new Distance($value, config('phpvms.internal_units.distance'));
|
||||||
} catch (NonNumericValue $e) {
|
} catch (NonNumericValue) {
|
||||||
} catch (NonStringUnitName $e) {
|
} catch (NonStringUnitName) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,8 +25,8 @@ class FuelCast implements CastsAttributes
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
return Fuel::make($value, config('phpvms.internal_units.fuel'));
|
return Fuel::make($value, config('phpvms.internal_units.fuel'));
|
||||||
} catch (NonNumericValue $e) {
|
} catch (NonNumericValue) {
|
||||||
} catch (NonStringUnitName $e) {
|
} catch (NonStringUnitName) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,8 +25,8 @@ class MassCast implements CastsAttributes
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
return Mass::make($value, config('phpvms.internal_units.mass'));
|
return Mass::make($value, config('phpvms.internal_units.mass'));
|
||||||
} catch (NonNumericValue $e) {
|
} catch (NonNumericValue) {
|
||||||
} catch (NonStringUnitName $e) {
|
} catch (NonStringUnitName) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Casts;
|
namespace App\Casts;
|
||||||
|
|
||||||
use App\Support\Money;
|
use App\Support\Money;
|
||||||
|
|||||||
@ -1,250 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
|
||||||
|
|
||||||
use App\Contracts\Command;
|
|
||||||
use App\Models\Flight;
|
|
||||||
use App\Support\Units\Time;
|
|
||||||
use GuzzleHttp\Client;
|
|
||||||
use Illuminate\Support\Collection;
|
|
||||||
use RuntimeException;
|
|
||||||
use stdClass;
|
|
||||||
|
|
||||||
class AcarsReplay extends Command
|
|
||||||
{
|
|
||||||
protected $signature = 'phpvms:replay {files} {--manual} {--write-all} {--no-submit}';
|
|
||||||
|
|
||||||
protected $description = 'Replay an ACARS file';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* API Key to post as
|
|
||||||
*/
|
|
||||||
protected string $apiKey = 'testadminapikey';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For automatic updates, how many seconds to sleep between updates
|
|
||||||
*/
|
|
||||||
protected int $sleepTime = 10;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array key == update[callsign]
|
|
||||||
* value == PIREP ID
|
|
||||||
*/
|
|
||||||
protected array $pirepList = [];
|
|
||||||
|
|
||||||
protected Client $httpClient;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return an instance of an HTTP client all ready to post
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
|
|
||||||
$this->httpClient = new Client([
|
|
||||||
'base_uri' => config('app.url'),
|
|
||||||
'headers' => [
|
|
||||||
'Authorization' => $this->apiKey,
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make a request to start a PIREP
|
|
||||||
*
|
|
||||||
* @param stdClass $flight
|
|
||||||
*
|
|
||||||
* @throws RuntimeException
|
|
||||||
*/
|
|
||||||
protected function startPirep($flight): string
|
|
||||||
{
|
|
||||||
// convert the planned flight time to be completely in minutes
|
|
||||||
$pft = Time::hoursToMinutes(
|
|
||||||
$flight->planned_hrsenroute,
|
|
||||||
$flight->planned_minenroute
|
|
||||||
);
|
|
||||||
|
|
||||||
$flight_number = substr($flight->callsign, 3);
|
|
||||||
|
|
||||||
$response = $this->httpClient->post('/api/pireps/prefile', [
|
|
||||||
'json' => [
|
|
||||||
'airline_id' => 1,
|
|
||||||
'flight_number' => $flight_number,
|
|
||||||
'aircraft_id' => 1,
|
|
||||||
'dpt_airport_id' => $flight->planned_depairport,
|
|
||||||
'arr_airport_id' => $flight->planned_destairport,
|
|
||||||
'level' => $flight->planned_altitude,
|
|
||||||
'planned_flight_time' => $pft,
|
|
||||||
'route' => $flight->planned_route,
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
|
|
||||||
$body = \json_decode($response->getBody()->getContents());
|
|
||||||
|
|
||||||
return $body->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mark the PIREP as filed
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*
|
|
||||||
* @throws RuntimeException
|
|
||||||
*/
|
|
||||||
protected function filePirep($pirep_id)
|
|
||||||
{
|
|
||||||
$response = $this->httpClient->post('/api/pireps/'.$pirep_id.'/file', [
|
|
||||||
'json' => [],
|
|
||||||
]);
|
|
||||||
|
|
||||||
$body = \json_decode($response->getBody()->getContents());
|
|
||||||
|
|
||||||
return $body;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @throws RuntimeException
|
|
||||||
*/
|
|
||||||
protected function postUpdate($pirep_id, $data)
|
|
||||||
{
|
|
||||||
$uri = '/api/pireps/'.$pirep_id.'/acars/position';
|
|
||||||
|
|
||||||
$position = [
|
|
||||||
'log' => '',
|
|
||||||
'lat' => $data->latitude,
|
|
||||||
'lon' => $data->longitude,
|
|
||||||
'heading' => $data->heading,
|
|
||||||
'altitude' => $data->altitude,
|
|
||||||
'altitude_agl' => $data->altitude,
|
|
||||||
'altitude_msl' => $data->altitude,
|
|
||||||
'gs' => $data->groundspeed,
|
|
||||||
'transponder' => $data->transponder,
|
|
||||||
];
|
|
||||||
|
|
||||||
$upd = [
|
|
||||||
'positions' => [
|
|
||||||
$position,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->info(
|
|
||||||
"Update: $data->callsign, $position[lat] x $position[lon] \t\t"
|
|
||||||
."hdg: $position[heading]\t\talt: $position[altitude]\t\tgs: $position[gs]"
|
|
||||||
);
|
|
||||||
|
|
||||||
$response = $this->httpClient->post($uri, [
|
|
||||||
'json' => $upd,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$body = \json_decode($response->getBody()->getContents());
|
|
||||||
|
|
||||||
return [
|
|
||||||
$data->callsign,
|
|
||||||
$position['lat'],
|
|
||||||
$position['lon'],
|
|
||||||
$position['heading'],
|
|
||||||
$position['altitude'],
|
|
||||||
$position['altitude_agl'],
|
|
||||||
$position['altitude_msl'],
|
|
||||||
$position['gs'],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse this file and run the updates
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @throws RuntimeException
|
|
||||||
*/
|
|
||||||
protected function updatesFromFile(array $files)
|
|
||||||
{
|
|
||||||
$flights = collect($files)->transform(function ($f) {
|
|
||||||
$file = $f;
|
|
||||||
if (file_exists($file)) {
|
|
||||||
$this->info('Loading '.$file);
|
|
||||||
$contents = file_get_contents($file);
|
|
||||||
$contents = \json_decode($contents);
|
|
||||||
|
|
||||||
return collect($contents->updates);
|
|
||||||
}
|
|
||||||
$this->error($file.' not found, skipping');
|
|
||||||
|
|
||||||
return false;
|
|
||||||
})
|
|
||||||
// remove any of errored file entries
|
|
||||||
->filter(function ($value, $key) {
|
|
||||||
return $value !== false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->info('Starting playback');
|
|
||||||
|
|
||||||
/*
|
|
||||||
* File the initial pirep to get a "preflight" status
|
|
||||||
*/
|
|
||||||
$flights->each(function (Collection $updates, $idx) {
|
|
||||||
$update = $updates->first();
|
|
||||||
$pirep_id = $this->startPirep($update);
|
|
||||||
$this->pirepList[$update->callsign] = $pirep_id;
|
|
||||||
$this->info('Prefiled '.$update->callsign.', ID: '.$pirep_id);
|
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Iterate through all of the flights, retrieving the updates
|
|
||||||
* from each individual flight. Remove the update. Continue through
|
|
||||||
* until there are no updates left, at which point we remove the flight
|
|
||||||
* and updates.
|
|
||||||
*
|
|
||||||
* Continue until we have no more flights and updates left
|
|
||||||
*/
|
|
||||||
while ($flights->count() > 0) {
|
|
||||||
$flights = $flights->each(function (Collection $updates, $idx) {
|
|
||||||
/** @var Flight $update */
|
|
||||||
$update = $updates->shift();
|
|
||||||
$pirep_id = $this->pirepList[$update->callsign];
|
|
||||||
|
|
||||||
$this->postUpdate($pirep_id, $update);
|
|
||||||
|
|
||||||
// we're done and don't put the "no-submit" option
|
|
||||||
if ($updates->count() === 0 && !$this->option('no-submit')) {
|
|
||||||
$this->filePirep($pirep_id);
|
|
||||||
}
|
|
||||||
})->filter(function ($updates, $idx) {
|
|
||||||
return $updates->count() > 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!$this->option('write-all')) {
|
|
||||||
if (!$this->option('manual')) {
|
|
||||||
sleep($this->sleepTime);
|
|
||||||
} else {
|
|
||||||
$this->confirm('Send next batch of updates?', true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute the console command.
|
|
||||||
*
|
|
||||||
* @throws RuntimeException
|
|
||||||
*/
|
|
||||||
public function handle(): void
|
|
||||||
{
|
|
||||||
$files = $this->argument('files');
|
|
||||||
$manual_mode = $this->option('manual');
|
|
||||||
|
|
||||||
if ($this->option('write-all')) {
|
|
||||||
$this->info('In "dump-all" mode, just writing it all in');
|
|
||||||
} elseif (!$manual_mode) {
|
|
||||||
/* @noinspection NestedPositiveIfStatementsInspection */
|
|
||||||
$this->info('Going to send updates every 10s');
|
|
||||||
} else {
|
|
||||||
$this->info('In "manual advance" mode');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->updatesFromFile(explode(',', $files));
|
|
||||||
$this->info('Done!');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App\Contracts\Command;
|
use App\Contracts\Command;
|
||||||
@ -14,12 +16,12 @@ class ClearCaches extends Command
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
self::clearCaches();
|
self::clearCaches();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function clearCaches()
|
public static function clearCaches(): void
|
||||||
{
|
{
|
||||||
// self::clearBootstrapCache();
|
// self::clearBootstrapCache();
|
||||||
self::clearModuleCache();
|
self::clearModuleCache();
|
||||||
@ -33,7 +35,7 @@ class ClearCaches extends Command
|
|||||||
/**
|
/**
|
||||||
* Rescan for new modules
|
* Rescan for new modules
|
||||||
*/
|
*/
|
||||||
private static function clearModuleCache()
|
private static function clearModuleCache(): void
|
||||||
{
|
{
|
||||||
Module::scan();
|
Module::scan();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,15 +15,12 @@ class ComposerCommand extends Command
|
|||||||
/**
|
/**
|
||||||
* Run composer update related commands
|
* Run composer update related commands
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
switch (trim($this->argument('cmd'))) {
|
match (trim($this->argument('cmd'))) {
|
||||||
case 'post-update':
|
'post-update' => $this->postUpdate(),
|
||||||
$this->postUpdate();
|
default => $this->error('Command exists'),
|
||||||
break;
|
};
|
||||||
default:
|
|
||||||
$this->error('Command exists');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App\Contracts\Command;
|
use App\Contracts\Command;
|
||||||
@ -28,7 +30,7 @@ class CreateConfigs extends Command
|
|||||||
*
|
*
|
||||||
* @throws FileException
|
* @throws FileException
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$this->writeConfigs();
|
$this->writeConfigs();
|
||||||
|
|
||||||
|
|||||||
@ -29,17 +29,14 @@ class CreateDatabase extends Command
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the mysql database
|
* Create the mysql database
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
protected function create_mysql_or_mariadb($dbkey)
|
protected function create_mysql_or_mariadb(string $dbkey): bool
|
||||||
{
|
{
|
||||||
$host = config($dbkey.'host');
|
$host = config($dbkey.'host');
|
||||||
$port = config($dbkey.'port');
|
$port = config($dbkey.'port');
|
||||||
$name = config($dbkey.'database');
|
$name = config($dbkey.'database');
|
||||||
$user = config($dbkey.'username');
|
config($dbkey.'username');
|
||||||
$pass = config($dbkey.'password');
|
config($dbkey.'password');
|
||||||
|
|
||||||
$dbSvc = new Database();
|
$dbSvc = new Database();
|
||||||
$dsn = $dbSvc->createDsn($host, $port);
|
$dsn = $dbSvc->createDsn($host, $port);
|
||||||
@ -47,14 +44,14 @@ class CreateDatabase extends Command
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$conn = DB::connection(config('database.default'))->getPdo();
|
$conn = DB::connection(config('database.default'))->getPdo();
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $pdoException) {
|
||||||
Log::error($e);
|
Log::error($pdoException);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->option('reset') === true) {
|
if ($this->option('reset') === true) {
|
||||||
$sql = "DROP DATABASE IF EXISTS `$name`";
|
$sql = sprintf('DROP DATABASE IF EXISTS `%s`', $name);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Log::info('Dropping database: '.$sql);
|
Log::info('Dropping database: '.$sql);
|
||||||
@ -64,13 +61,13 @@ class CreateDatabase extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "CREATE DATABASE IF NOT EXISTS `$name` CHARACTER SET UTF8MB4 COLLATE utf8mb4_unicode_ci";
|
$sql = sprintf('CREATE DATABASE IF NOT EXISTS `%s` CHARACTER SET UTF8MB4 COLLATE utf8mb4_unicode_ci', $name);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Log::info('Creating database: '.$sql);
|
Log::info('Creating database: '.$sql);
|
||||||
$conn->exec($sql);
|
$conn->exec($sql);
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $pdoException) {
|
||||||
Log::error($e);
|
Log::error($pdoException);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -81,7 +78,7 @@ class CreateDatabase extends Command
|
|||||||
/**
|
/**
|
||||||
* Create the sqlite database
|
* Create the sqlite database
|
||||||
*/
|
*/
|
||||||
protected function create_sqlite($dbkey)
|
protected function create_sqlite(string $dbkey)
|
||||||
{
|
{
|
||||||
$dbPath = config($dbkey.'database');
|
$dbPath = config($dbkey.'database');
|
||||||
|
|
||||||
@ -117,10 +114,8 @@ class CreateDatabase extends Command
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
/*if ($this->option('reset')) {
|
/*if ($this->option('reset')) {
|
||||||
if(!$this->confirm('The "reset" option will destroy the database, are you sure?')) {
|
if(!$this->confirm('The "reset" option will destroy the database, are you sure?')) {
|
||||||
|
|||||||
@ -28,22 +28,18 @@ class DevCommands extends Command
|
|||||||
|
|
||||||
protected $description = 'Developer commands';
|
protected $description = 'Developer commands';
|
||||||
|
|
||||||
protected DatabaseService $dbSvc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DevCommands constructor.
|
* DevCommands constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(DatabaseService $dbSvc)
|
public function __construct(protected DatabaseService $dbSvc)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->dbSvc = $dbSvc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run dev related commands
|
* Run dev related commands
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$command = trim($this->argument('cmd'));
|
$command = trim($this->argument('cmd'));
|
||||||
|
|
||||||
@ -86,7 +82,7 @@ class DevCommands extends Command
|
|||||||
$headers = ['Award Name', 'Class'];
|
$headers = ['Award Name', 'Class'];
|
||||||
$formatted_awards = [];
|
$formatted_awards = [];
|
||||||
foreach ($awards as $award) {
|
foreach ($awards as $award) {
|
||||||
$formatted_awards[] = [$award->name, \get_class($award)];
|
$formatted_awards[] = [$award->name, $award::class];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->table($headers, $formatted_awards);
|
$this->table($headers, $formatted_awards);
|
||||||
@ -217,7 +213,7 @@ class DevCommands extends Command
|
|||||||
$this->info('Reading '.$file);
|
$this->info('Reading '.$file);
|
||||||
|
|
||||||
if (!file_exists($file)) {
|
if (!file_exists($file)) {
|
||||||
$this->error('File '.$file.' doesn\'t exist');
|
$this->error('File '.$file." doesn't exist");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,7 +249,7 @@ class DevCommands extends Command
|
|||||||
protected function resetInstall(): void
|
protected function resetInstall(): void
|
||||||
{
|
{
|
||||||
$confirm = $this->ask('This will erase your entire install and database, are you sure? y/n ');
|
$confirm = $this->ask('This will erase your entire install and database, are you sure? y/n ');
|
||||||
if (strtolower($confirm) !== 'y') {
|
if (strtolower((string) $confirm) !== 'y') {
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,22 +266,22 @@ class DevCommands extends Command
|
|||||||
foreach ($tables as $table) {
|
foreach ($tables as $table) {
|
||||||
Schema::dropIfExists($table);
|
Schema::dropIfExists($table);
|
||||||
}
|
}
|
||||||
} catch (QueryException $e) {
|
} catch (QueryException $queryException) {
|
||||||
$this->error('DB error: '.$e->getMessage());
|
$this->error('DB error: '.$queryException->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->info('Deleting config file');
|
$this->info('Deleting config file');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
unlink('config.php');
|
unlink('config.php');
|
||||||
} catch (Exception $e) {
|
} catch (Exception) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->info('Deleting env file');
|
$this->info('Deleting env file');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
unlink('env.php');
|
unlink('env.php');
|
||||||
} catch (Exception $e) {
|
} catch (Exception) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->info('Clearing caches');
|
$this->info('Clearing caches');
|
||||||
@ -309,6 +305,6 @@ class DevCommands extends Command
|
|||||||
|
|
||||||
public function liveFlights(): void
|
public function liveFlights(): void
|
||||||
{
|
{
|
||||||
$flights = Pirep::activeFlights(setting('acars.live_time'))->get()->toArray();
|
Pirep::activeFlights(setting('acars.live_time'))->get()->toArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,7 @@ class DevInstall extends Command
|
|||||||
*
|
*
|
||||||
* @throws FileException
|
* @throws FileException
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
if ($this->option('reset-configs')) {
|
if ($this->option('reset-configs')) {
|
||||||
$this->rewriteConfigs();
|
$this->rewriteConfigs();
|
||||||
|
|||||||
@ -19,7 +19,7 @@ class EmailTest extends Command
|
|||||||
*
|
*
|
||||||
* @throws FileException
|
* @throws FileException
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
/** @var NotificationEventsHandler $eventHandler */
|
/** @var NotificationEventsHandler $eventHandler */
|
||||||
$eventHandler = app(NotificationEventsHandler::class);
|
$eventHandler = app(NotificationEventsHandler::class);
|
||||||
|
|||||||
@ -12,24 +12,18 @@ class ImportCsv extends Command
|
|||||||
|
|
||||||
protected $description = 'Import from a CSV file';
|
protected $description = 'Import from a CSV file';
|
||||||
|
|
||||||
private ImportService $importer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Import constructor.
|
* Import constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(ImportService $importer)
|
public function __construct(private readonly ImportService $importer)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->importer = $importer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed|void
|
|
||||||
*
|
|
||||||
* @throws ValidationException
|
* @throws ValidationException
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$type = $this->argument('type');
|
$type = $this->argument('type');
|
||||||
$file = $this->argument('file');
|
$file = $this->argument('file');
|
||||||
|
|||||||
@ -16,7 +16,7 @@ class ImportFromClassicCommand extends Command
|
|||||||
/**
|
/**
|
||||||
* Run dev related commands
|
* Run dev related commands
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$creds = [
|
$creds = [
|
||||||
'host' => $this->argument('db_host'),
|
'host' => $this->argument('db_host'),
|
||||||
@ -29,6 +29,7 @@ class ImportFromClassicCommand extends Command
|
|||||||
$importerSvc = new LegacyImporterService();
|
$importerSvc = new LegacyImporterService();
|
||||||
|
|
||||||
$importerSvc->saveCredentials($creds);
|
$importerSvc->saveCredentials($creds);
|
||||||
|
|
||||||
$manifest = $importerSvc->generateImportManifest();
|
$manifest = $importerSvc->generateImportManifest();
|
||||||
|
|
||||||
foreach ($manifest as $record) {
|
foreach ($manifest as $record) {
|
||||||
|
|||||||
@ -34,17 +34,17 @@ class ModuleSetupFilament extends Command implements \Illuminate\Contracts\Conso
|
|||||||
|
|
||||||
private string $panelStub = 'resources/stubs/modules/admin-panel-provider.stub';
|
private string $panelStub = 'resources/stubs/modules/admin-panel-provider.stub';
|
||||||
|
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$moduleName = $this->argument('module');
|
$moduleName = $this->argument('module');
|
||||||
$this->module = app('modules')->find($moduleName);
|
$this->module = app('modules')->find($moduleName);
|
||||||
|
|
||||||
if (!$this->module instanceof Module) {
|
if (!$this->module instanceof Module) {
|
||||||
$this->fail("Module {$moduleName} not found, are you sure it's installed and enabled?");
|
$this->fail(sprintf("Module %s not found, are you sure it's installed and enabled?", $moduleName));
|
||||||
}
|
}
|
||||||
|
|
||||||
// The provider file path
|
// The provider file path
|
||||||
$path = str($this->module->getExtraPath("{$this->basePath}/{$this->className}"))
|
$path = str($this->module->getExtraPath(sprintf('%s/%s', $this->basePath, $this->className)))
|
||||||
->replace('\\', '/')
|
->replace('\\', '/')
|
||||||
->append('.php')->toString();
|
->append('.php')->toString();
|
||||||
|
|
||||||
@ -59,11 +59,11 @@ class ModuleSetupFilament extends Command implements \Illuminate\Contracts\Conso
|
|||||||
'MODULE_NAMESPACE' => $this->laravel['modules']->config('namespace'),
|
'MODULE_NAMESPACE' => $this->laravel['modules']->config('namespace'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->info("The {$this->className} has been created at {$path}");
|
$this->info(sprintf('The %s has been created at %s', $this->className, $path));
|
||||||
|
|
||||||
$this->info("Adding {$this->className} to module.json and composer.json");
|
$this->info(sprintf('Adding %s to module.json and composer.json', $this->className));
|
||||||
|
|
||||||
$provider = "{$namespace}\\{$this->className}";
|
$provider = sprintf('%s\%s', $namespace, $this->className);
|
||||||
|
|
||||||
$moduleJson = json_decode($this->readFile(module_path($this->module->getName(), 'module.json')), true);
|
$moduleJson = json_decode($this->readFile(module_path($this->module->getName(), 'module.json')), true);
|
||||||
$providers = collect($moduleJson['providers']);
|
$providers = collect($moduleJson['providers']);
|
||||||
@ -81,7 +81,7 @@ class ModuleSetupFilament extends Command implements \Illuminate\Contracts\Conso
|
|||||||
$this->writeFile(module_path($this->module->getName(), 'composer.json'), json_encode($composerJson, JSON_PRETTY_PRINT));
|
$this->writeFile(module_path($this->module->getName(), 'composer.json'), json_encode($composerJson, JSON_PRETTY_PRINT));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->info("Module {$this->module->getName()} is now ready for Filament!");
|
$this->info(sprintf('Module %s is now ready for Filament!', $this->module->getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function copyPanelStubToApp(string $targetPath, ?array $replacements = []): void
|
protected function copyPanelStubToApp(string $targetPath, ?array $replacements = []): void
|
||||||
@ -91,13 +91,13 @@ class ModuleSetupFilament extends Command implements \Illuminate\Contracts\Conso
|
|||||||
$panelStubPath = base_path($this->panelStub);
|
$panelStubPath = base_path($this->panelStub);
|
||||||
|
|
||||||
if (!$this->fileExists($panelStubPath)) {
|
if (!$this->fileExists($panelStubPath)) {
|
||||||
$this->fail("The panel stub file does not exist at {$panelStubPath}");
|
$this->fail('The panel stub file does not exist at '.$panelStubPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
$stub = str($filesystem->get($panelStubPath));
|
$stub = str($filesystem->get($panelStubPath));
|
||||||
|
|
||||||
foreach ($replacements as $key => $replacement) {
|
foreach ($replacements as $key => $replacement) {
|
||||||
$stub = $stub->replace("{{ {$key} }}", $replacement);
|
$stub = $stub->replace(sprintf('{{ %s }}', $key), $replacement);
|
||||||
$stub = $stub->replace('$'.$key.'$', $replacement);
|
$stub = $stub->replace('$'.$key.'$', $replacement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ class ModuleSetupFilament extends Command implements \Illuminate\Contracts\Conso
|
|||||||
$filesystem = app(Filesystem::class);
|
$filesystem = app(Filesystem::class);
|
||||||
|
|
||||||
if (!$this->fileExists($path)) {
|
if (!$this->fileExists($path)) {
|
||||||
$this->fail("The file does not exist at {$path}");
|
$this->fail('The file does not exist at '.$path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $filesystem->get($path);
|
return $filesystem->get($path);
|
||||||
|
|||||||
@ -14,11 +14,9 @@ class NavdataImport extends Command
|
|||||||
protected $description = '';
|
protected $description = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$this->info('Emptying the current navdata...');
|
$this->info('Emptying the current navdata...');
|
||||||
Navdata::query()->truncate();
|
Navdata::query()->truncate();
|
||||||
@ -78,39 +76,24 @@ class NavdataImport extends Command
|
|||||||
|
|
||||||
foreach ($generator as $line) {
|
foreach ($generator as $line) {
|
||||||
$navaid = [
|
$navaid = [
|
||||||
'id' => trim(substr($line, 24, 4)), // ident column
|
'id' => trim(substr((string) $line, 24, 4)), // ident column
|
||||||
'name' => trim(substr($line, 0, 24)),
|
'name' => trim(substr((string) $line, 0, 24)),
|
||||||
'type' => trim(substr($line, 29, 4)),
|
'type' => trim(substr((string) $line, 29, 4)),
|
||||||
'lat' => trim(substr($line, 33, 9)),
|
'lat' => trim(substr((string) $line, 33, 9)),
|
||||||
'lon' => trim(substr($line, 43, 11)),
|
'lon' => trim(substr((string) $line, 43, 11)),
|
||||||
'freq' => trim(substr($line, 54, 6)),
|
'freq' => trim(substr((string) $line, 54, 6)),
|
||||||
'class' => trim($line[60]),
|
'class' => trim((string) $line[60]),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Map to the Navaid enum
|
// Map to the Navaid enum
|
||||||
switch ($navaid['type']) {
|
$navaid['type'] = match ($navaid['type']) {
|
||||||
case 'ILS':
|
'ILS' => NavaidType::LOC,
|
||||||
$navaid['type'] = NavaidType::LOC;
|
'ILSDME' => NavaidType::LOC_DME,
|
||||||
break;
|
'NDB', 'NDBM', 'NDBO', 'MARI' => NavaidType::NDB,
|
||||||
case 'ILSDME':
|
'VOR' => NavaidType::VOR,
|
||||||
$navaid['type'] = NavaidType::LOC_DME;
|
'VORD' => NavaidType::VOR_DME,
|
||||||
break;
|
default => NavaidType::UNKNOWN,
|
||||||
case 'NDB':
|
};
|
||||||
case 'NDBM':
|
|
||||||
case 'NDBO':
|
|
||||||
case 'MARI':
|
|
||||||
$navaid['type'] = NavaidType::NDB;
|
|
||||||
break;
|
|
||||||
case 'VOR':
|
|
||||||
$navaid['type'] = NavaidType::VOR;
|
|
||||||
break;
|
|
||||||
case 'VORD':
|
|
||||||
$navaid['type'] = NavaidType::VOR_DME;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$navaid['type'] = NavaidType::UNKNOWN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*if($navaid['id'] === 'LCH' || $navaid['id'] === 'RSG') {
|
/*if($navaid['id'] === 'LCH' || $navaid['id'] === 'RSG') {
|
||||||
print_r($navaid);
|
print_r($navaid);
|
||||||
@ -163,11 +146,11 @@ class NavdataImport extends Command
|
|||||||
$imported = 0;
|
$imported = 0;
|
||||||
foreach ($generator as $line) {
|
foreach ($generator as $line) {
|
||||||
$navfix = [
|
$navfix = [
|
||||||
'id' => trim(substr($line, 0, 4)), // ident column
|
'id' => trim(substr((string) $line, 0, 4)), // ident column
|
||||||
'name' => trim(substr($line, 24, 6)),
|
'name' => trim(substr((string) $line, 24, 6)),
|
||||||
'type' => NavaidType::FIX,
|
'type' => NavaidType::FIX,
|
||||||
'lat' => trim(substr($line, 30, 10)),
|
'lat' => trim(substr((string) $line, 30, 10)),
|
||||||
'lon' => trim(substr($line, 40, 11)),
|
'lon' => trim(substr((string) $line, 40, 11)),
|
||||||
];
|
];
|
||||||
|
|
||||||
Navdata::updateOrCreate([
|
Navdata::updateOrCreate([
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App\Contracts\Command;
|
use App\Contracts\Command;
|
||||||
@ -15,7 +17,7 @@ class PirepExport extends Command
|
|||||||
/**
|
/**
|
||||||
* Run dev related commands
|
* Run dev related commands
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$pirep_id = $this->argument('id');
|
$pirep_id = $this->argument('id');
|
||||||
if (empty($pirep_id)) {
|
if (empty($pirep_id)) {
|
||||||
|
|||||||
@ -16,7 +16,7 @@ class ProcessQueue extends Command
|
|||||||
/**
|
/**
|
||||||
* Run the queue tasks
|
* Run the queue tasks
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
Artisan::call('queue:work', [
|
Artisan::call('queue:work', [
|
||||||
// '--sansdaemon' => null,
|
// '--sansdaemon' => null,
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App\Contracts\Command;
|
use App\Contracts\Command;
|
||||||
@ -17,7 +19,7 @@ class RewriteConfigs extends Command
|
|||||||
/**
|
/**
|
||||||
* Run dev related commands
|
* Run dev related commands
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
/** @var ConfigService $configSvc */
|
/** @var ConfigService $configSvc */
|
||||||
$configSvc = app(ConfigService::class);
|
$configSvc = app(ConfigService::class);
|
||||||
|
|||||||
@ -14,7 +14,7 @@ class TestApi extends Command
|
|||||||
/**
|
/**
|
||||||
* Run dev related commands
|
* Run dev related commands
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$this->httpClient = new Client([
|
$this->httpClient = new Client([
|
||||||
'headers' => [
|
'headers' => [
|
||||||
|
|||||||
@ -13,13 +13,9 @@ class Version extends Command
|
|||||||
{
|
{
|
||||||
protected $signature = 'phpvms:version {--write} {--base-only} {--write-full-version} {version?}';
|
protected $signature = 'phpvms:version {--write} {--base-only} {--write-full-version} {version?}';
|
||||||
|
|
||||||
private VersionService $versionSvc;
|
public function __construct(private readonly VersionService $versionSvc)
|
||||||
|
|
||||||
public function __construct(VersionService $versionSvc)
|
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->versionSvc = $versionSvc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,7 +23,7 @@ class Version extends Command
|
|||||||
*
|
*
|
||||||
* @throws ParseException
|
* @throws ParseException
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
if ($this->option('write')) {
|
if ($this->option('write')) {
|
||||||
// Write the updated build number out to the file
|
// Write the updated build number out to the file
|
||||||
|
|||||||
@ -18,7 +18,7 @@ class YamlExport extends Command
|
|||||||
/**
|
/**
|
||||||
* Run dev related commands
|
* Run dev related commands
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$tables = $this->argument('tables');
|
$tables = $this->argument('tables');
|
||||||
if (empty($tables)) {
|
if (empty($tables)) {
|
||||||
|
|||||||
@ -15,16 +15,12 @@ class YamlImport extends Command
|
|||||||
|
|
||||||
protected $description = 'Developer commands';
|
protected $description = 'Developer commands';
|
||||||
|
|
||||||
protected DatabaseService $dbSvc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* YamlImport constructor.
|
* YamlImport constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(DatabaseService $dbSvc)
|
public function __construct(protected DatabaseService $dbSvc)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->dbSvc = $dbSvc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,7 +28,7 @@ class YamlImport extends Command
|
|||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$files = $this->argument('files');
|
$files = $this->argument('files');
|
||||||
if (empty($files)) {
|
if (empty($files)) {
|
||||||
@ -44,7 +40,7 @@ class YamlImport extends Command
|
|||||||
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (!file_exists($file)) {
|
if (!file_exists($file)) {
|
||||||
$this->error('File '.$file.' doesn\'t exist');
|
$this->error('File '.$file." doesn't exist");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,13 +24,10 @@ use Illuminate\Console\Scheduling\Schedule;
|
|||||||
|
|
||||||
class Cron
|
class Cron
|
||||||
{
|
{
|
||||||
/** @var Schedule */
|
|
||||||
private $scheduler;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string[] The cron tasks which get called/run
|
* @var string[] The cron tasks which get called/run
|
||||||
*/
|
*/
|
||||||
private $cronTasks = [
|
private array $cronTasks = [
|
||||||
JobQueue::class,
|
JobQueue::class,
|
||||||
FiveMinute::class,
|
FiveMinute::class,
|
||||||
FifteenMinute::class,
|
FifteenMinute::class,
|
||||||
@ -50,9 +47,8 @@ class Cron
|
|||||||
*/
|
*/
|
||||||
private $cronRunners = [];
|
private $cronRunners = [];
|
||||||
|
|
||||||
public function __construct(Schedule $scheduler)
|
public function __construct(private readonly Schedule $scheduler)
|
||||||
{
|
{
|
||||||
$this->scheduler = $scheduler;
|
|
||||||
foreach ($this->cronTasks as $task) {
|
foreach ($this->cronTasks as $task) {
|
||||||
/** @var Command $cronTask */
|
/** @var Command $cronTask */
|
||||||
$cronTask = app($task);
|
$cronTask = app($task);
|
||||||
@ -83,7 +79,7 @@ class Cron
|
|||||||
/** @var Event $event */
|
/** @var Event $event */
|
||||||
foreach ($events as $event) {
|
foreach ($events as $event) {
|
||||||
foreach ($this->cronRunners as $signature => $task) {
|
foreach ($this->cronRunners as $signature => $task) {
|
||||||
if (!str_contains($event->command, $signature)) {
|
if (!str_contains((string) $event->command, (string) $signature)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ class FifteenMinute extends CronCommand
|
|||||||
$this->callEvent();
|
$this->callEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function callEvent()
|
public function callEvent(): void
|
||||||
{
|
{
|
||||||
event(new CronFifteenMinute());
|
event(new CronFifteenMinute());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ class FiveMinute extends CronCommand
|
|||||||
$this->callEvent();
|
$this->callEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function callEvent()
|
public function callEvent(): void
|
||||||
{
|
{
|
||||||
event(new CronFiveMinute());
|
event(new CronFiveMinute());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class Hourly extends CronCommand
|
|||||||
$this->callEvent();
|
$this->callEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function callEvent()
|
public function callEvent(): void
|
||||||
{
|
{
|
||||||
event(new CronHourly());
|
event(new CronHourly());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,7 @@ class JobQueue extends CronCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function callEvent()
|
public function callEvent(): void
|
||||||
{
|
{
|
||||||
Artisan::call('queue:cron');
|
Artisan::call('queue:cron');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ class Monthly extends CronCommand
|
|||||||
$this->callEvent();
|
$this->callEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function callEvent()
|
public function callEvent(): void
|
||||||
{
|
{
|
||||||
event(new CronMonthly());
|
event(new CronMonthly());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ class Nightly extends CronCommand
|
|||||||
$this->callEvent();
|
$this->callEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function callEvent()
|
public function callEvent(): void
|
||||||
{
|
{
|
||||||
event(new CronNightly());
|
event(new CronNightly());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,7 @@ class ThirtyMinute extends CronCommand
|
|||||||
$this->callEvent();
|
$this->callEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function callEvent()
|
public function callEvent(): void
|
||||||
{
|
{
|
||||||
event(new CronThirtyMinute());
|
event(new CronThirtyMinute());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Console\Cron;
|
namespace App\Console\Cron;
|
||||||
|
|
||||||
use App\Contracts\CronCommand;
|
use App\Contracts\CronCommand;
|
||||||
@ -24,7 +26,7 @@ class Weekly extends CronCommand
|
|||||||
$this->callEvent();
|
$this->callEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function callEvent()
|
public function callEvent(): void
|
||||||
{
|
{
|
||||||
event(new CronWeekly());
|
event(new CronWeekly());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Console;
|
namespace App\Console;
|
||||||
|
|
||||||
use App\Console\Cron\ActivityLogClean;
|
use App\Console\Cron\ActivityLogClean;
|
||||||
@ -27,6 +29,7 @@ class Kernel extends ConsoleKernel
|
|||||||
* Then the CronServiceProvider has the list of cronjobs which then run according to the events
|
* Then the CronServiceProvider has the list of cronjobs which then run according to the events
|
||||||
* and then calls those at the proper times.
|
* and then calls those at the proper times.
|
||||||
*/
|
*/
|
||||||
|
#[\Override]
|
||||||
protected function schedule(Schedule $schedule): void
|
protected function schedule(Schedule $schedule): void
|
||||||
{
|
{
|
||||||
// If not using the queue worker then run those via cron
|
// If not using the queue worker then run those via cron
|
||||||
@ -70,6 +73,7 @@ class Kernel extends ConsoleKernel
|
|||||||
/**
|
/**
|
||||||
* Register the Closure based commands for the application.
|
* Register the Closure based commands for the application.
|
||||||
*/
|
*/
|
||||||
|
#[\Override]
|
||||||
protected function commands(): void
|
protected function commands(): void
|
||||||
{
|
{
|
||||||
$this->load(__DIR__.'/Commands');
|
$this->load(__DIR__.'/Commands');
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Console;
|
namespace App\Console;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
@ -10,13 +12,13 @@ use Monolog\Handler\StreamHandler;
|
|||||||
*/
|
*/
|
||||||
class Logger
|
class Logger
|
||||||
{
|
{
|
||||||
public function __invoke(array $config)
|
public function __invoke(array $config): \Monolog\Logger
|
||||||
{
|
{
|
||||||
$logger = new \Monolog\Logger('console');
|
$logger = new \Monolog\Logger('console');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$logger->pushHandler(new StreamHandler('php://stdout'));
|
$logger->pushHandler(new StreamHandler('php://stdout'));
|
||||||
} catch (Exception $e) {
|
} catch (Exception) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return $logger;
|
return $logger;
|
||||||
|
|||||||
@ -12,14 +12,11 @@ class Database
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create the base connection DSN, optionally include the DB name
|
* Create the base connection DSN, optionally include the DB name
|
||||||
*
|
|
||||||
* @param null $name
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function createDsn($host, $port, $name = null)
|
public function createDsn($host, $port, $name = null): string
|
||||||
{
|
{
|
||||||
$conn = config('database.default');
|
$conn = config('database.default');
|
||||||
$dsn = "$conn:host=$host;port=$port";
|
$dsn = sprintf('%s:host=%s;port=%s', $conn, $host, $port);
|
||||||
if (filled($name)) {
|
if (filled($name)) {
|
||||||
$dsn .= ';dbname='.$name;
|
$dsn .= ';dbname='.$name;
|
||||||
}
|
}
|
||||||
@ -28,18 +25,12 @@ class Database
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return PDO
|
|
||||||
*
|
|
||||||
* @throws PDOException
|
* @throws PDOException
|
||||||
*/
|
*/
|
||||||
public function createPDO($dsn, $user, $pass)
|
public function createPDO($dsn, $user, $pass): PDO
|
||||||
{
|
{
|
||||||
try {
|
|
||||||
$conn = new PDO($dsn, $user, $pass);
|
$conn = new PDO($dsn, $user, $pass);
|
||||||
$conn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
|
$conn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
|
||||||
} catch (PDOException $e) {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $conn;
|
return $conn;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Contracts;
|
namespace App\Contracts;
|
||||||
|
|
||||||
use App\Models\Airport;
|
use VaCentral\Models\Airport;
|
||||||
|
|
||||||
abstract class AirportLookup
|
abstract class AirportLookup
|
||||||
{
|
{
|
||||||
@ -20,7 +22,7 @@ abstract class AirportLookup
|
|||||||
* @example App\Services\AirportLookup\VaCentralLookup
|
* @example App\Services\AirportLookup\VaCentralLookup
|
||||||
*
|
*
|
||||||
* @param string $icao
|
* @param string $icao
|
||||||
* @return Airport|null
|
* @return Airport|array
|
||||||
*/
|
*/
|
||||||
abstract public function getAirport($icao);
|
abstract public function getAirport($icao);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,19 +31,7 @@ abstract class Award
|
|||||||
*/
|
*/
|
||||||
abstract public function check($parameter = null): bool;
|
abstract public function check($parameter = null): bool;
|
||||||
|
|
||||||
/*
|
public function __construct(protected ?AwardModel $award = null, protected ?User $user = null) {}
|
||||||
* You don't really need to mess with anything below here
|
|
||||||
*/
|
|
||||||
|
|
||||||
protected ?AwardModel $award;
|
|
||||||
|
|
||||||
protected ?User $user;
|
|
||||||
|
|
||||||
public function __construct(?AwardModel $award = null, ?User $user = null)
|
|
||||||
{
|
|
||||||
$this->award = $award;
|
|
||||||
$this->user = $user;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the main handler for this award class to determine if
|
* Run the main handler for this award class to determine if
|
||||||
@ -83,10 +71,10 @@ abstract class Award
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$award->save();
|
$award->save();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $exception) {
|
||||||
Log::error(
|
Log::error(
|
||||||
'Error saving award: '.$e->getMessage(),
|
'Error saving award: '.$exception->getMessage(),
|
||||||
$e->getTrace()
|
$exception->getTrace()
|
||||||
);
|
);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Contracts;
|
namespace App\Contracts;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
|
|||||||
@ -44,7 +44,7 @@ abstract class Controller extends \Illuminate\Routing\Controller
|
|||||||
{
|
{
|
||||||
// See if a list of values is passed in, or if a validation list is passed in
|
// See if a list of values is passed in, or if a validation list is passed in
|
||||||
$is_validation = false;
|
$is_validation = false;
|
||||||
if (array_filter(array_keys($attrs_or_validations), '\is_string') !== []) {
|
if (array_filter(array_keys($attrs_or_validations), \is_string(...)) !== []) {
|
||||||
$is_validation = true;
|
$is_validation = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ abstract class Controller extends \Illuminate\Routing\Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($addtl_fields !== null && $addtl_fields !== []) {
|
if ($addtl_fields !== null && $addtl_fields !== []) {
|
||||||
$fields = array_merge($fields, $addtl_fields);
|
return array_merge($fields, $addtl_fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Contracts;
|
namespace App\Contracts;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|||||||
@ -17,15 +17,10 @@ abstract class Enum
|
|||||||
|
|
||||||
protected static array $labels = [];
|
protected static array $labels = [];
|
||||||
|
|
||||||
protected int $value;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an instance of this Enum
|
* Create an instance of this Enum
|
||||||
*/
|
*/
|
||||||
final public function __construct($val)
|
final public function __construct(protected int $value) {}
|
||||||
{
|
|
||||||
$this->value = $val;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the value that's been set if this is an instance
|
* Return the value that's been set if this is an instance
|
||||||
@ -42,7 +37,7 @@ abstract class Enum
|
|||||||
{
|
{
|
||||||
if (isset(static::$labels[$value])) {
|
if (isset(static::$labels[$value])) {
|
||||||
$val = static::$labels[$value];
|
$val = static::$labels[$value];
|
||||||
if (strpos($val, '.') !== false) {
|
if (str_contains($val, '.')) {
|
||||||
return trans($val);
|
return trans($val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,21 +126,19 @@ abstract class Enum
|
|||||||
|
|
||||||
final public function equals(self $enum): bool
|
final public function equals(self $enum): bool
|
||||||
{
|
{
|
||||||
return $this->getValue() === $enum->getValue() && static::class === \get_class($enum);
|
return $this->getValue() === $enum->getValue() && static::class === $enum::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a value when called statically like so: MyEnum::SOME_VALUE() given SOME_VALUE is a
|
* Returns a value when called statically like so: MyEnum::SOME_VALUE() given SOME_VALUE is a
|
||||||
* class constant
|
* class constant
|
||||||
*
|
*
|
||||||
* @param string $name
|
|
||||||
* @param array $arguments
|
|
||||||
* @return static
|
* @return static
|
||||||
*
|
*
|
||||||
* @throws BadMethodCallException
|
* @throws BadMethodCallException
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public static function __callStatic($name, $arguments)
|
public static function __callStatic(string $name, array $arguments)
|
||||||
{
|
{
|
||||||
$array = static::toArray();
|
$array = static::toArray();
|
||||||
if (isset($array[$name])) {
|
if (isset($array[$name])) {
|
||||||
@ -153,7 +146,7 @@ abstract class Enum
|
|||||||
}
|
}
|
||||||
|
|
||||||
throw new BadMethodCallException(
|
throw new BadMethodCallException(
|
||||||
"No static method or enum constant '$name' in class ".static::class
|
sprintf("No static method or enum constant '%s' in class ", $name).static::class
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Contracts;
|
namespace App\Contracts;
|
||||||
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Contracts;
|
namespace App\Contracts;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory as EloquentFactory;
|
use Illuminate\Database\Eloquent\Factories\Factory as EloquentFactory;
|
||||||
|
|||||||
@ -21,11 +21,8 @@ class FormRequest extends \Illuminate\Foundation\Http\FormRequest
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a given column as being unique
|
* Set a given column as being unique
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function unique($table)
|
public function unique($table): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Rule::unique($table)->ignore($this->id, 'id'),
|
Rule::unique($table)->ignore($this->id, 'id'),
|
||||||
|
|||||||
@ -49,11 +49,9 @@ class ImportExport
|
|||||||
*/
|
*/
|
||||||
public function getAirline($code): Airline
|
public function getAirline($code): Airline
|
||||||
{
|
{
|
||||||
$airline = Airline::firstOrCreate([
|
return Airline::firstOrCreate([
|
||||||
'icao' => $code,
|
'icao' => $code,
|
||||||
], ['name' => $code]);
|
], ['name' => $code]);
|
||||||
|
|
||||||
return $airline;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -114,7 +112,7 @@ class ImportExport
|
|||||||
*/
|
*/
|
||||||
protected function kvpToArray($kvp_str, array &$arr)
|
protected function kvpToArray($kvp_str, array &$arr)
|
||||||
{
|
{
|
||||||
$item = explode('=', $kvp_str);
|
$item = explode('=', (string) $kvp_str);
|
||||||
if (\count($item) === 1) { // just a list?
|
if (\count($item) === 1) { // just a list?
|
||||||
$arr[] = trim($item[0]);
|
$arr[] = trim($item[0]);
|
||||||
} else { // actually a key-value pair
|
} else { // actually a key-value pair
|
||||||
@ -131,14 +129,11 @@ class ImportExport
|
|||||||
* gate=B32;cost index=100
|
* gate=B32;cost index=100
|
||||||
*
|
*
|
||||||
* Converted into a multi-dimensional array
|
* Converted into a multi-dimensional array
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return array|string
|
|
||||||
*/
|
*/
|
||||||
public function parseMultiColumnValues($field)
|
public function parseMultiColumnValues($field): array
|
||||||
{
|
{
|
||||||
$ret = [];
|
$ret = [];
|
||||||
$split_values = explode(';', $field);
|
$split_values = explode(';', (string) $field);
|
||||||
|
|
||||||
// No multiple values in here, just a straight value
|
// No multiple values in here, just a straight value
|
||||||
if (\count($split_values) === 1) {
|
if (\count($split_values) === 1) {
|
||||||
@ -146,7 +141,7 @@ class ImportExport
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($split_values[0], '?') !== false) {
|
if (str_contains($split_values[0], '?')) {
|
||||||
// This contains the query string, which turns it into a multi-level array
|
// This contains the query string, which turns it into a multi-level array
|
||||||
$query_str = explode('?', $split_values[0]);
|
$query_str = explode('?', $split_values[0]);
|
||||||
$parent = trim($query_str[0]);
|
$parent = trim($query_str[0]);
|
||||||
@ -154,7 +149,11 @@ class ImportExport
|
|||||||
$children = [];
|
$children = [];
|
||||||
$kvp = explode('&', trim($query_str[1]));
|
$kvp = explode('&', trim($query_str[1]));
|
||||||
foreach ($kvp as $items) {
|
foreach ($kvp as $items) {
|
||||||
if ($items === '' || $items === '0') {
|
if ($items === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($items === '0') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +177,7 @@ class ImportExport
|
|||||||
|
|
||||||
// This isn't in the query string format, so it's
|
// This isn't in the query string format, so it's
|
||||||
// just a straight key-value pair set
|
// just a straight key-value pair set
|
||||||
if (strpos($value, '?') === false) {
|
if (!str_contains($value, '?')) {
|
||||||
$this->kvpToArray($value, $ret);
|
$this->kvpToArray($value, $ret);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@ -193,7 +192,11 @@ class ImportExport
|
|||||||
$children = [];
|
$children = [];
|
||||||
$kvp = explode('&', trim($query_str[1]));
|
$kvp = explode('&', trim($query_str[1]));
|
||||||
foreach ($kvp as $items) {
|
foreach ($kvp as $items) {
|
||||||
if ($items === '' || $items === '0') {
|
if ($items === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($items === '0') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,19 +226,19 @@ class ImportExport
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = trim($key);
|
$key = trim((string) $key);
|
||||||
|
|
||||||
if (!\is_array($val)) {
|
if (!\is_array($val)) {
|
||||||
$val = trim($val);
|
$val = trim((string) $val);
|
||||||
$ret_list[] = "{$key}={$val}";
|
$ret_list[] = sprintf('%s=%s', $key, $val);
|
||||||
} else {
|
} else {
|
||||||
$q = [];
|
$q = [];
|
||||||
foreach ($val as $subkey => $subval) {
|
foreach ($val as $subkey => $subval) {
|
||||||
$q[] = is_numeric($subkey) ? $subval : "{$subkey}={$subval}";
|
$q[] = is_numeric($subkey) ? $subval : sprintf('%s=%s', $subkey, $subval);
|
||||||
}
|
}
|
||||||
|
|
||||||
$q = implode('&', $q);
|
$q = implode('&', $q);
|
||||||
$ret_list[] = $q === '' || $q === '0' ? $key : "{$key}?{$q}";
|
$ret_list[] = $q === '' || $q === '0' ? $key : sprintf('%s?%s', $key, $q);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ abstract class Metar
|
|||||||
/**
|
/**
|
||||||
* Download the METAR, wrap in caching
|
* Download the METAR, wrap in caching
|
||||||
*/
|
*/
|
||||||
public function metar($icao): string
|
public function metar(string $icao): string
|
||||||
{
|
{
|
||||||
$cache = config('cache.keys.METAR_WEATHER_LOOKUP');
|
$cache = config('cache.keys.METAR_WEATHER_LOOKUP');
|
||||||
$key = $cache['key'].$icao;
|
$key = $cache['key'].$icao;
|
||||||
@ -41,8 +41,8 @@ abstract class Metar
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$raw_metar = $this->get_metar($icao);
|
$raw_metar = $this->get_metar($icao);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $exception) {
|
||||||
Log::error('Error getting METAR: '.$e->getMessage(), $e->getTrace());
|
Log::error('Error getting METAR: '.$exception->getMessage(), $exception->getTrace());
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ abstract class Metar
|
|||||||
/**
|
/**
|
||||||
* Download the TAF, wrap in caching
|
* Download the TAF, wrap in caching
|
||||||
*/
|
*/
|
||||||
public function taf($icao): string
|
public function taf(string $icao): string
|
||||||
{
|
{
|
||||||
$cache = config('cache.keys.TAF_WEATHER_LOOKUP');
|
$cache = config('cache.keys.TAF_WEATHER_LOOKUP');
|
||||||
$key = $cache['key'].$icao;
|
$key = $cache['key'].$icao;
|
||||||
@ -71,8 +71,8 @@ abstract class Metar
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$taf = $this->get_taf($icao);
|
$taf = $this->get_taf($icao);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $exception) {
|
||||||
Log::error('Error getting TAF: '.$e->getMessage(), $e->getTrace());
|
Log::error('Error getting TAF: '.$exception->getMessage(), $exception->getTrace());
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Contracts;
|
namespace App\Contracts;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
|
|||||||
@ -32,21 +32,21 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
|
|||||||
*
|
*
|
||||||
* @param string $file Full path to yml file to seed
|
* @param string $file Full path to yml file to seed
|
||||||
*/
|
*/
|
||||||
public function seedFile($file): void
|
public function seedFile(string $file): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$path = base_path($file);
|
$path = base_path($file);
|
||||||
Database::seed_from_yaml_file($path, false);
|
Database::seed_from_yaml_file($path, false);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $exception) {
|
||||||
Log::error('Unable to load '.$file.' file');
|
Log::error('Unable to load '.$file.' file');
|
||||||
Log::error($e);
|
Log::error($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add rows to a table
|
* Add rows to a table
|
||||||
*/
|
*/
|
||||||
public function addData($table, $rows)
|
public function addData($table, $rows): void
|
||||||
{
|
{
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
try {
|
try {
|
||||||
@ -67,7 +67,7 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
|
|||||||
*
|
*
|
||||||
* @throws ValidationException
|
* @throws ValidationException
|
||||||
*/
|
*/
|
||||||
public function addAward(array $award)
|
public function addAward(array $award): void
|
||||||
{
|
{
|
||||||
$validator = Validator::make($award, Award::$rules);
|
$validator = Validator::make($award, Award::$rules);
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Contracts;
|
namespace App\Contracts;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Contracts\Modules;
|
namespace App\Contracts\Modules;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -36,6 +38,7 @@ abstract class ServiceProvider extends \Illuminate\Support\ServiceProvider
|
|||||||
* Deferred providers:
|
* Deferred providers:
|
||||||
* https://laravel.com/docs/7.x/providers#deferred-providers
|
* https://laravel.com/docs/7.x/providers#deferred-providers
|
||||||
*/
|
*/
|
||||||
|
#[\Override]
|
||||||
public function provides(): array
|
public function provides(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Contracts;
|
namespace App\Contracts;
|
||||||
|
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
|
|||||||
@ -23,7 +23,7 @@ class Resource extends JsonResource
|
|||||||
* Iterate through the list of $fields and check if they're a "Unit"
|
* Iterate through the list of $fields and check if they're a "Unit"
|
||||||
* If they are, then add the response
|
* If they are, then add the response
|
||||||
*/
|
*/
|
||||||
public function checkUnitFields(&$response, array $fields): void
|
public function checkUnitFields(array &$response, array $fields): void
|
||||||
{
|
{
|
||||||
foreach ($fields as $f) {
|
foreach ($fields as $f) {
|
||||||
$response[$f] = $this->{$f} instanceof Unit ? $this->{$f}->getResponseUnits() : $this->{$f};
|
$response[$f] = $this->{$f} instanceof Unit ? $this->{$f}->getResponseUnits() : $this->{$f};
|
||||||
@ -37,6 +37,7 @@ class Resource extends JsonResource
|
|||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
|
#[\Override]
|
||||||
public function toResponse($request)
|
public function toResponse($request)
|
||||||
{
|
{
|
||||||
return $this->resource instanceof AbstractPaginator
|
return $this->resource instanceof AbstractPaginator
|
||||||
@ -44,9 +45,10 @@ class Resource extends JsonResource
|
|||||||
: parent::toResponse($request);
|
: parent::toResponse($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\Override]
|
||||||
public static function collection($resource)
|
public static function collection($resource)
|
||||||
{
|
{
|
||||||
return tap(new CustomAnonymousResourceCollection($resource, static::class), function ($collection) {
|
return tap(new CustomAnonymousResourceCollection($resource, static::class), function ($collection): void {
|
||||||
if (property_exists(static::class, 'preserveKeys')) {
|
if (property_exists(static::class, 'preserveKeys')) {
|
||||||
// TODO: figure out what is this preserveKeys thing and whether we still need this
|
// TODO: figure out what is this preserveKeys thing and whether we still need this
|
||||||
// @phpstan-ignore-next-line
|
// @phpstan-ignore-next-line
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Contracts;
|
namespace App\Contracts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Contracts;
|
namespace App\Contracts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -8,7 +8,7 @@ use Exception;
|
|||||||
/**
|
/**
|
||||||
* Abstract unit wrapper
|
* Abstract unit wrapper
|
||||||
*/
|
*/
|
||||||
abstract class Unit implements ArrayAccess
|
abstract class Unit implements \Stringable, ArrayAccess
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The localized unit the user wants it displayed in
|
* The localized unit the user wants it displayed in
|
||||||
@ -137,10 +137,7 @@ abstract class Unit implements ArrayAccess
|
|||||||
// $this->units[$offset] = null;
|
// $this->units[$offset] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function __toString(): string
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function __toString()
|
|
||||||
{
|
{
|
||||||
return (string) $this->offsetGet($this->localUnit);
|
return (string) $this->offsetGet($this->localUnit);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Contracts;
|
namespace App\Contracts;
|
||||||
|
|
||||||
use Arrilot\Widgets\AbstractWidget;
|
use Arrilot\Widgets\AbstractWidget;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Cron\Hourly;
|
namespace App\Cron\Hourly;
|
||||||
|
|
||||||
use App\Contracts\Listener;
|
use App\Contracts\Listener;
|
||||||
@ -12,12 +14,7 @@ use Illuminate\Support\Facades\Log;
|
|||||||
*/
|
*/
|
||||||
class ClearExpiredSimbrief extends Listener
|
class ClearExpiredSimbrief extends Listener
|
||||||
{
|
{
|
||||||
private SimBriefService $simbriefSvc;
|
public function __construct(private readonly SimBriefService $simbriefSvc) {}
|
||||||
|
|
||||||
public function __construct(SimBriefService $simbriefSvc)
|
|
||||||
{
|
|
||||||
$this->simbriefSvc = $simbriefSvc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function handle(CronHourly $event): void
|
public function handle(CronHourly $event): void
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Cron\Monthly;
|
namespace App\Cron\Monthly;
|
||||||
|
|
||||||
use App\Contracts\Listener;
|
use App\Contracts\Listener;
|
||||||
@ -15,15 +17,10 @@ use UnexpectedValueException;
|
|||||||
*/
|
*/
|
||||||
class ApplyExpenses extends Listener
|
class ApplyExpenses extends Listener
|
||||||
{
|
{
|
||||||
private RecurringFinanceService $financeSvc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ApplyExpenses constructor.
|
* ApplyExpenses constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(RecurringFinanceService $financeSvc)
|
public function __construct(private readonly RecurringFinanceService $financeSvc) {}
|
||||||
{
|
|
||||||
$this->financeSvc = $financeSvc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply all of the expenses for a month
|
* Apply all of the expenses for a month
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Cron\Nightly;
|
namespace App\Cron\Nightly;
|
||||||
|
|
||||||
use App\Contracts\Listener;
|
use App\Contracts\Listener;
|
||||||
@ -15,15 +17,10 @@ use UnexpectedValueException;
|
|||||||
*/
|
*/
|
||||||
class ApplyExpenses extends Listener
|
class ApplyExpenses extends Listener
|
||||||
{
|
{
|
||||||
private RecurringFinanceService $financeSvc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ApplyExpenses constructor.
|
* ApplyExpenses constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(RecurringFinanceService $financeSvc)
|
public function __construct(private readonly RecurringFinanceService $financeSvc) {}
|
||||||
{
|
|
||||||
$this->financeSvc = $financeSvc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply all of the expenses for a day
|
* Apply all of the expenses for a day
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Cron\Nightly;
|
namespace App\Cron\Nightly;
|
||||||
|
|
||||||
use App\Contracts\Listener;
|
use App\Contracts\Listener;
|
||||||
@ -9,12 +11,7 @@ use Illuminate\Support\Facades\Log;
|
|||||||
|
|
||||||
class NewVersionCheck extends Listener
|
class NewVersionCheck extends Listener
|
||||||
{
|
{
|
||||||
private VersionService $versionSvc;
|
public function __construct(private readonly VersionService $versionSvc) {}
|
||||||
|
|
||||||
public function __construct(VersionService $versionSvc)
|
|
||||||
{
|
|
||||||
$this->versionSvc = $versionSvc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set any users to being on leave after X days
|
* Set any users to being on leave after X days
|
||||||
|
|||||||
@ -14,15 +14,10 @@ use UnexpectedValueException;
|
|||||||
*/
|
*/
|
||||||
class PilotLeave extends Listener
|
class PilotLeave extends Listener
|
||||||
{
|
{
|
||||||
private UserService $userSvc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PilotLeave constructor.
|
* PilotLeave constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(UserService $userSvc)
|
public function __construct(private readonly UserService $userSvc) {}
|
||||||
{
|
|
||||||
$this->userSvc = $userSvc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set any users to being on leave after X days
|
* Set any users to being on leave after X days
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Cron\Nightly;
|
namespace App\Cron\Nightly;
|
||||||
|
|
||||||
use App\Contracts\Listener;
|
use App\Contracts\Listener;
|
||||||
@ -15,15 +17,7 @@ use UnexpectedValueException;
|
|||||||
*/
|
*/
|
||||||
class RecalculateStats extends Listener
|
class RecalculateStats extends Listener
|
||||||
{
|
{
|
||||||
private AircraftService $aircraftSvc;
|
public function __construct(private readonly AircraftService $aircraftSvc, private readonly UserService $userSvc) {}
|
||||||
|
|
||||||
private UserService $userSvc;
|
|
||||||
|
|
||||||
public function __construct(AircraftService $aircraftSvc, UserService $userSvc)
|
|
||||||
{
|
|
||||||
$this->aircraftSvc = $aircraftSvc;
|
|
||||||
$this->userSvc = $userSvc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recalculate the stats for active users
|
* Recalculate the stats for active users
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Cron\Nightly;
|
namespace App\Cron\Nightly;
|
||||||
|
|
||||||
use App\Contracts\Listener;
|
use App\Contracts\Listener;
|
||||||
|
|||||||
@ -40,6 +40,7 @@ class SetActiveFlights extends Listener
|
|||||||
if (!$flight->active) {
|
if (!$flight->active) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set visible default
|
// Set visible default
|
||||||
$flight->visible = true;
|
$flight->visible = true;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Cron\Weekly;
|
namespace App\Cron\Weekly;
|
||||||
|
|
||||||
use App\Contracts\Listener;
|
use App\Contracts\Listener;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -8,13 +10,5 @@ use App\Models\Pirep;
|
|||||||
|
|
||||||
class AcarsUpdate extends Event
|
class AcarsUpdate extends Event
|
||||||
{
|
{
|
||||||
public Pirep $pirep;
|
public function __construct(public Pirep $pirep, public Acars $acars) {}
|
||||||
|
|
||||||
public Acars $acars;
|
|
||||||
|
|
||||||
public function __construct(Pirep $pirep, Acars $acars)
|
|
||||||
{
|
|
||||||
$this->pirep = $pirep;
|
|
||||||
$this->acars = $acars;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -7,10 +9,5 @@ use App\Models\UserAward;
|
|||||||
|
|
||||||
class AwardAwarded extends Event
|
class AwardAwarded extends Event
|
||||||
{
|
{
|
||||||
public UserAward $userAward;
|
public function __construct(public UserAward $userAward) {}
|
||||||
|
|
||||||
public function __construct(UserAward $userAward)
|
|
||||||
{
|
|
||||||
$this->userAward = $userAward;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -8,7 +10,4 @@ use App\Contracts\Event;
|
|||||||
* This event is dispatched when the weekly cron is run
|
* This event is dispatched when the weekly cron is run
|
||||||
* It happens after all of the default nightly tasks
|
* It happens after all of the default nightly tasks
|
||||||
*/
|
*/
|
||||||
class CronWeekly extends Event
|
class CronWeekly extends Event {}
|
||||||
{
|
|
||||||
public function __construct() {}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -28,10 +30,5 @@ use App\Models\Pirep;
|
|||||||
*/
|
*/
|
||||||
class Expenses extends Event
|
class Expenses extends Event
|
||||||
{
|
{
|
||||||
public ?Pirep $pirep;
|
public function __construct(public ?Pirep $pirep = null) {}
|
||||||
|
|
||||||
public function __construct(?Pirep $pirep = null)
|
|
||||||
{
|
|
||||||
$this->pirep = $pirep;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -27,10 +29,5 @@ use App\Models\Pirep;
|
|||||||
*/
|
*/
|
||||||
class Fares extends Event
|
class Fares extends Event
|
||||||
{
|
{
|
||||||
public ?Pirep $pirep;
|
public function __construct(public ?Pirep $pirep = null) {}
|
||||||
|
|
||||||
public function __construct(?Pirep $pirep = null)
|
|
||||||
{
|
|
||||||
$this->pirep = $pirep;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -7,10 +9,5 @@ use App\Models\News;
|
|||||||
|
|
||||||
class NewsAdded extends Event
|
class NewsAdded extends Event
|
||||||
{
|
{
|
||||||
public News $news;
|
public function __construct(public News $news) {}
|
||||||
|
|
||||||
public function __construct(News $news)
|
|
||||||
{
|
|
||||||
$this->news = $news;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -7,10 +9,5 @@ use App\Models\Pirep;
|
|||||||
|
|
||||||
class PirepAccepted extends Event
|
class PirepAccepted extends Event
|
||||||
{
|
{
|
||||||
public Pirep $pirep;
|
public function __construct(public Pirep $pirep) {}
|
||||||
|
|
||||||
public function __construct(Pirep $pirep)
|
|
||||||
{
|
|
||||||
$this->pirep = $pirep;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -7,10 +9,5 @@ use App\Models\Pirep;
|
|||||||
|
|
||||||
class PirepCancelled extends Event
|
class PirepCancelled extends Event
|
||||||
{
|
{
|
||||||
public Pirep $pirep;
|
public function __construct(public Pirep $pirep) {}
|
||||||
|
|
||||||
public function __construct(Pirep $pirep)
|
|
||||||
{
|
|
||||||
$this->pirep = $pirep;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -7,10 +9,5 @@ use App\Models\Pirep;
|
|||||||
|
|
||||||
class PirepDiverted extends Event
|
class PirepDiverted extends Event
|
||||||
{
|
{
|
||||||
public Pirep $pirep;
|
public function __construct(public Pirep $pirep) {}
|
||||||
|
|
||||||
public function __construct(Pirep $pirep)
|
|
||||||
{
|
|
||||||
$this->pirep = $pirep;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -7,10 +9,5 @@ use App\Models\Pirep;
|
|||||||
|
|
||||||
class PirepFiled extends Event
|
class PirepFiled extends Event
|
||||||
{
|
{
|
||||||
public Pirep $pirep;
|
public function __construct(public Pirep $pirep) {}
|
||||||
|
|
||||||
public function __construct(Pirep $pirep)
|
|
||||||
{
|
|
||||||
$this->pirep = $pirep;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -7,10 +9,5 @@ use App\Models\Pirep;
|
|||||||
|
|
||||||
class PirepPrefiled extends Event
|
class PirepPrefiled extends Event
|
||||||
{
|
{
|
||||||
public Pirep $pirep;
|
public function __construct(public Pirep $pirep) {}
|
||||||
|
|
||||||
public function __construct(Pirep $pirep)
|
|
||||||
{
|
|
||||||
$this->pirep = $pirep;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -7,10 +9,5 @@ use App\Models\Pirep;
|
|||||||
|
|
||||||
class PirepRejected extends Event
|
class PirepRejected extends Event
|
||||||
{
|
{
|
||||||
public Pirep $pirep;
|
public function __construct(public Pirep $pirep) {}
|
||||||
|
|
||||||
public function __construct(Pirep $pirep)
|
|
||||||
{
|
|
||||||
$this->pirep = $pirep;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -7,10 +9,5 @@ use App\Models\Pirep;
|
|||||||
|
|
||||||
class PirepStateChange extends Event
|
class PirepStateChange extends Event
|
||||||
{
|
{
|
||||||
public Pirep $pirep;
|
public function __construct(public Pirep $pirep) {}
|
||||||
|
|
||||||
public function __construct(Pirep $pirep)
|
|
||||||
{
|
|
||||||
$this->pirep = $pirep;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -10,10 +12,5 @@ use App\Models\Pirep;
|
|||||||
*/
|
*/
|
||||||
class PirepStatusChange extends Event
|
class PirepStatusChange extends Event
|
||||||
{
|
{
|
||||||
public Pirep $pirep;
|
public function __construct(public Pirep $pirep) {}
|
||||||
|
|
||||||
public function __construct(Pirep $pirep)
|
|
||||||
{
|
|
||||||
$this->pirep = $pirep;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -7,10 +9,5 @@ use App\Models\Pirep;
|
|||||||
|
|
||||||
class PirepUpdated extends Event
|
class PirepUpdated extends Event
|
||||||
{
|
{
|
||||||
public Pirep $pirep;
|
public function __construct(public Pirep $pirep) {}
|
||||||
|
|
||||||
public function __construct(Pirep $pirep)
|
|
||||||
{
|
|
||||||
$this->pirep = $pirep;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -10,10 +12,5 @@ use App\Models\User;
|
|||||||
*/
|
*/
|
||||||
class ProcessAward extends Event
|
class ProcessAward extends Event
|
||||||
{
|
{
|
||||||
public User $user;
|
public function __construct(public User $user) {}
|
||||||
|
|
||||||
public function __construct(User $user)
|
|
||||||
{
|
|
||||||
$this->user = $user;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
@ -13,8 +15,14 @@ class ProfileUpdated
|
|||||||
use InteractsWithSockets;
|
use InteractsWithSockets;
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var User
|
||||||
|
*/
|
||||||
public $user;
|
public $user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
public $avatarUpdated;
|
public $avatarUpdated;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -7,10 +9,5 @@ use App\Models\User;
|
|||||||
|
|
||||||
class TestEvent extends Event
|
class TestEvent extends Event
|
||||||
{
|
{
|
||||||
public User $user;
|
public function __construct(public User $user) {}
|
||||||
|
|
||||||
public function __construct(User $user)
|
|
||||||
{
|
|
||||||
$this->user = $user;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -7,10 +9,5 @@ use App\Models\User;
|
|||||||
|
|
||||||
class UserAccepted extends Event
|
class UserAccepted extends Event
|
||||||
{
|
{
|
||||||
public User $user;
|
public function __construct(public User $user) {}
|
||||||
|
|
||||||
public function __construct(User $user)
|
|
||||||
{
|
|
||||||
$this->user = $user;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -10,13 +12,5 @@ use App\Models\User;
|
|||||||
*/
|
*/
|
||||||
class UserStateChanged extends Event
|
class UserStateChanged extends Event
|
||||||
{
|
{
|
||||||
public User $user;
|
public function __construct(public User $user, public $old_state) {}
|
||||||
|
|
||||||
public $old_state;
|
|
||||||
|
|
||||||
public function __construct(User $user, $old_state)
|
|
||||||
{
|
|
||||||
$this->user = $user;
|
|
||||||
$this->old_state = $old_state;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use App\Contracts\Event;
|
||||||
@ -7,22 +9,11 @@ use App\Models\User;
|
|||||||
|
|
||||||
class UserStatsChanged extends Event
|
class UserStatsChanged extends Event
|
||||||
{
|
{
|
||||||
public User $user;
|
|
||||||
|
|
||||||
public $stat_name;
|
|
||||||
|
|
||||||
public $old_value;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When a user's stats change. Stats changed match the field name:
|
* When a user's stats change. Stats changed match the field name:
|
||||||
* airport
|
* airport
|
||||||
* flights
|
* flights
|
||||||
* rank
|
* rank
|
||||||
*/
|
*/
|
||||||
public function __construct(User $user, $stat_name, $old_value)
|
public function __construct(public User $user, public $stat_name, public $old_value) {}
|
||||||
{
|
|
||||||
$this->user = $user;
|
|
||||||
$this->stat_name = $stat_name;
|
|
||||||
$this->old_value = $old_value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Exceptions;
|
namespace App\Exceptions;
|
||||||
|
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Exceptions;
|
namespace App\Exceptions;
|
||||||
|
|
||||||
class AirportNotFound extends AbstractHttpException
|
class AirportNotFound extends AbstractHttpException
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Exceptions;
|
namespace App\Exceptions;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Exceptions;
|
namespace App\Exceptions;
|
||||||
|
|
||||||
use App\Models\Aircraft;
|
use App\Models\Aircraft;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user