Form updates
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Models\Airline;
|
||||||
|
use App\Models\Alliance;
|
||||||
|
use Illuminate\Console\Attributes\Description;
|
||||||
|
use Illuminate\Console\Attributes\Signature;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
|
|
||||||
|
#[Signature('app:update-alliances')]
|
||||||
|
#[Description('Looks for any changes to Alliance membership and updates automatically')]
|
||||||
|
class UpdateAlliances extends Command
|
||||||
|
{
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$time = now('UTC')->startOfMinute();
|
||||||
|
$day = Date('Y-m-d', $time);
|
||||||
|
|
||||||
|
if($day == '2026-12-17'){
|
||||||
|
Airline::whereInternalName('asiana')->update(['alliance' => null]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($day == '2027-12-12'){
|
||||||
|
$oneworld = Alliance::whereInternalName('oneworld')->first();
|
||||||
|
Airline::whereInternalName('philippine-airlines')->update(['alliance' => $oneworld->id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,5 +3,6 @@
|
|||||||
use Illuminate\Foundation\Inspiring;
|
use Illuminate\Foundation\Inspiring;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
use Illuminate\Support\Facades\Artisan;
|
||||||
|
|
||||||
|
Schedule::command('app:update-alliances')->dailyAt('09:00')->runInBackground();
|
||||||
Schedule::command('app:update-departed-flights')->hourly()->runInBackground();
|
Schedule::command('app:update-departed-flights')->hourly()->runInBackground();
|
||||||
Schedule::command('app:flight-feed-update')->everyMinute()->runInBackground();
|
Schedule::command('app:flight-feed-update')->everyMinute()->runInBackground();
|
||||||
|
|||||||
Reference in New Issue
Block a user