forked from nabeelio/phpvms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into bug-fix-nabeelio#1275
- Loading branch information
Showing
232 changed files
with
4,619 additions
and
3,711 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
app/Database/migrations/2022_12_17_211036_add_callsign_to_users.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
use App\Contracts\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class() extends Migration { | ||
public function up() | ||
{ | ||
Schema::table('users', function (Blueprint $table) { | ||
$table->string('callsign')->nullable()->after('pilot_id'); | ||
}); | ||
} | ||
}; |
36 changes: 36 additions & 0 deletions
36
app/Database/migrations/2022_12_27_192218_create_events.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
// Add events table and update flights & pirep tables for references | ||
return new class() extends Migration { | ||
public function up() | ||
{ | ||
// Create events table | ||
Schema::create('events', function (Blueprint $table) { | ||
$table->integer('id'); | ||
$table->unsignedInteger('type')->default(0); | ||
$table->string('name', 250); | ||
$table->text('description')->nullable(); | ||
$table->date('start_date'); | ||
$table->date('end_date'); | ||
$table->boolean('active')->default(false)->nullable(); | ||
$table->timestamps(); | ||
// Add index | ||
$table->primary('id'); | ||
}); | ||
|
||
// Update flights table | ||
Schema::table('flights', function (Blueprint $table) { | ||
$table->unsignedInteger('event_id')->nullable()->after('visible'); | ||
$table->unsignedInteger('user_id')->nullable()->after('event_id'); | ||
}); | ||
|
||
// Update pireps table | ||
Schema::table('pireps', function (Blueprint $table) { | ||
$table->unsignedInteger('event_id')->nullable()->after('aircraft_id'); | ||
}); | ||
} | ||
}; |
14 changes: 14 additions & 0 deletions
14
app/Database/migrations/2023_01_28_174436_add_lastlogin_at_to_users.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
use App\Contracts\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class() extends Migration { | ||
public function up() | ||
{ | ||
Schema::table('users', function (Blueprint $table) { | ||
$table->timestamp('lastlogin_at')->nullable()->after('last_ip'); | ||
}); | ||
} | ||
}; |
46 changes: 46 additions & 0 deletions
46
app/Database/migrations/2023_05_08_174436_add_fare_details_to_pirep.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
use App\Contracts\Migration; | ||
use App\Models\Enums\FareType; | ||
use App\Models\PirepFare; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class() extends Migration { | ||
public function up() | ||
{ | ||
Schema::table('pirep_fares', function (Blueprint $table) { | ||
$table->unsignedBigInteger('fare_id')->nullable()->change(); | ||
$table->string('code')->nullable(); | ||
$table->string('name')->nullable(); | ||
$table->unsignedDecimal('price')->nullable()->default(0.00); | ||
$table->unsignedDecimal('cost')->nullable()->default(0.00); | ||
$table->unsignedInteger('capacity')->nullable()->default(0); | ||
$table->unsignedTinyInteger('type') | ||
->default(FareType::PASSENGER) | ||
->nullable() | ||
->after('capacity'); | ||
}); | ||
|
||
/** | ||
* Update all of the existing PIREP fares to include the existing fare info | ||
*/ | ||
$all_fares = PirepFare::with('fare')->get(); | ||
/** @var PirepFare $fare */ | ||
foreach ($all_fares as $fare) { | ||
if (empty($fare->fare)) { | ||
continue; | ||
} | ||
|
||
$fare->code = $fare->fare->code; | ||
$fare->name = $fare->fare->name; | ||
$fare->capacity = $fare->fare->capacity; | ||
$fare->price = $fare->fare->price; | ||
$fare->cost = $fare->fare->cost; | ||
$fare->type = $fare->fare->type; | ||
$fare->fare_id = null; | ||
|
||
$fare->save(); | ||
} | ||
} | ||
}; |
38 changes: 38 additions & 0 deletions
38
app/Database/migrations/2023_05_16_174436_migrate_fare_capacity.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
use App\Contracts\Migration; | ||
use App\Models\PirepFare; | ||
|
||
/** | ||
* Check if the PIREP fare has an empty capacity and update it from the subfleet | ||
*/ | ||
return new class() extends Migration { | ||
public function up() | ||
{ | ||
$cached = []; | ||
$fareSvc = app(App\Services\FareService::class); | ||
$all_fares = PirepFare::with('pirep', 'pirep.aircraft', 'pirep.aircraft.subfleet')->get(); | ||
|
||
/** @var PirepFare $fare */ | ||
foreach ($all_fares as $fare) { | ||
if (empty($fare->pirep) || !empty($fare->capacity)) { // has capacity, skip | ||
continue; | ||
} | ||
|
||
// look up the subfleet | ||
$subfleet = $fare->pirep->aircraft->subfleet; | ||
if (empty($subfleet)) { | ||
continue; | ||
} | ||
|
||
if (empty($cached[$subfleet->id])) { | ||
$cached[$subfleet->id] = $fareSvc->getForSubfleet($subfleet); | ||
} | ||
|
||
/** @var \App\Models\Fare $sf */ | ||
$sf = $cached[$subfleet->id]->where('code', $fare->code)->first(); | ||
$fare->capacity = empty($sf) ? $fare->count : $sf->capacity; | ||
$fare->save(); | ||
} | ||
} | ||
}; |
59 changes: 59 additions & 0 deletions
59
app/Database/migrations/2023_06_24_072812_add_softdelete_fields.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
// Adds deleted_at fields to tables with SoftDelete trait | ||
return new class() extends Migration { | ||
public function up() | ||
{ | ||
// Aircraft | ||
Schema::table('aircraft', function (Blueprint $table) { | ||
$table->softDeletes(); | ||
}); | ||
|
||
// Airline | ||
Schema::table('airlines', function (Blueprint $table) { | ||
$table->softDeletes(); | ||
}); | ||
|
||
// Airport | ||
Schema::table('airports', function (Blueprint $table) { | ||
$table->softDeletes(); | ||
}); | ||
|
||
// Award | ||
Schema::table('awards', function (Blueprint $table) { | ||
$table->softDeletes(); | ||
}); | ||
|
||
// Fare | ||
Schema::table('fares', function (Blueprint $table) { | ||
$table->softDeletes(); | ||
}); | ||
|
||
// Flight | ||
Schema::table('flights', function (Blueprint $table) { | ||
$table->softDeletes(); | ||
}); | ||
|
||
// Pirep | ||
Schema::table('pireps', function (Blueprint $table) { | ||
$table->softDeletes(); | ||
}); | ||
|
||
// Rank | ||
Schema::table('ranks', function (Blueprint $table) { | ||
$table->softDeletes(); | ||
}); | ||
|
||
// Subfleet | ||
Schema::table('subfleets', function (Blueprint $table) { | ||
$table->softDeletes(); | ||
}); | ||
|
||
// User table already have required field | ||
// Schema::table('users', function (Blueprint $table) { $table->softDeletes(); }); | ||
} | ||
}; |
14 changes: 14 additions & 0 deletions
14
app/Database/migrations/2023_06_24_204216_add_description_to_pirepfields.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
use App\Contracts\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class() extends Migration { | ||
public function up() | ||
{ | ||
Schema::table('pirep_fields', function (Blueprint $table) { | ||
$table->string('description')->nullable()->after('slug'); | ||
}); | ||
} | ||
}; |
14 changes: 14 additions & 0 deletions
14
app/Database/migrations/2023_06_24_211137_add_fin_to_aircraft.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
use App\Contracts\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class() extends Migration { | ||
public function up() | ||
{ | ||
Schema::table('aircraft', function (Blueprint $table) { | ||
$table->string('fin', 5)->unique()->nullable()->after('registration'); | ||
}); | ||
} | ||
}; |
Oops, something went wrong.