forked from nabeelio/phpvms
-
Notifications
You must be signed in to change notification settings - Fork 1
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 squashMigrations
- Loading branch information
Showing
41 changed files
with
717 additions
and
138 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
21 changes: 21 additions & 0 deletions
21
app/Database/migrations/2024_01_26_142501_add_vatsim_id_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,21 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class() extends Migration { | ||
public function up(): void | ||
{ | ||
Schema::table('users', function (Blueprint $table) { | ||
$table->string('vatsim_id')->default('')->after('discord_private_channel_id'); | ||
}); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
Schema::table('users', function (Blueprint $table) { | ||
$table->dropColumn('vatsim_id'); | ||
}); | ||
} | ||
}; |
27 changes: 27 additions & 0 deletions
27
app/Database/migrations/2024_06_03_124335_add_ivao_id_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,27 @@ | ||
<?php | ||
|
||
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 | ||
{ | ||
Schema::table('users', function (Blueprint $table) { | ||
$table->string('ivao_id')->default('')->after('discord_private_channel_id'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::table('users', function (Blueprint $table) { | ||
$table->dropColumn('ivao_id'); | ||
}); | ||
} | ||
}; |
49 changes: 49 additions & 0 deletions
49
app/Database/migrations_data/2023_12_19_174436_correct_expenses.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,49 @@ | ||
<?php | ||
|
||
use App\Contracts\Migration; | ||
use App\Models\Expense; | ||
|
||
/** | ||
* Update the expenses to add the airline ID | ||
*/ | ||
return new class() extends Migration { | ||
public function up(): void | ||
{ | ||
/** @var Expense[] $all_expenses */ | ||
$all_expenses = Expense::all(); | ||
foreach ($all_expenses as $expense) { | ||
$this->getAirlineId($expense); | ||
} | ||
} | ||
|
||
/** | ||
* Figure out the airline ID | ||
* | ||
* @param Expense $expense | ||
* | ||
* @return void | ||
*/ | ||
public function getAirlineId(Expense $expense): void | ||
{ | ||
$klass = 'Expense'; | ||
if ($expense->ref_model) { | ||
$ref = explode('\\', $expense->ref_model); | ||
$klass = end($ref); | ||
$obj = $expense->getReferencedObject(); | ||
} | ||
|
||
if (empty($obj)) { | ||
return; | ||
} | ||
|
||
if ($klass === 'Airport') { | ||
// TODO: Get an airline ID? | ||
} elseif ($klass === 'Subfleet') { | ||
$expense->airline_id = $obj->airline_id; | ||
} elseif ($klass === 'Aircraft') { | ||
$expense->airline_id = $obj->airline->id; | ||
} | ||
|
||
$expense->save(); | ||
} | ||
}; |
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 | ||
|
||
namespace App\Events; | ||
|
||
use App\Contracts\Event; | ||
use App\Models\News; | ||
|
||
class NewsUpdated extends Event | ||
{ | ||
public function __construct( | ||
public News $news | ||
) { | ||
} | ||
} |
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
Oops, something went wrong.