Files
FlightsAPI/database/migrations/2026_05_19_032711_add_pacific_blue.php
T
2026-05-19 21:45:24 +10:00

40 lines
944 B
PHP

<?php
use App\Models\Airline;
use App\Models\Country;
use App\Models\UserFlight;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Airline::create([
'name' => 'Pacific Blue',
'internal_name' => 'pacific-blue',
'IATA_code' => 'DJ',
'ICAO_code' => 'PBN',
'active' => false,
'logo' => 'pacific-blue.png',
'country_id' => Country::where('code', 'NZ')->first()->id,
]);
$flightIds = [326, 327];
UserFlight::whereIn('id', $flightIds)->update(['airline_id' => Airline::where('internal_name', 'pacific-blue')->first()->id]);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};