Issue fixes (#413)
* Auto lookup missing airports closes #404 * Ensure flight ICAOs are capitalized closes #404 * Update htaccess in root closes #412 * Update htaccess in root closes #412 * StyleCI fix
This commit is contained in:
29
app/Models/Observers/FlightObserver.php
Normal file
29
app/Models/Observers/FlightObserver.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Observers;
|
||||
|
||||
use App\Models\Flight;
|
||||
|
||||
/**
|
||||
* Make sure that the fields are properly capitalized
|
||||
*/
|
||||
class FlightObserver
|
||||
{
|
||||
/**
|
||||
* @param Flight $flight
|
||||
*/
|
||||
public function creating(Flight $flight): void
|
||||
{
|
||||
$flight->dpt_airport_id = strtoupper(trim($flight->dpt_airport_id));
|
||||
$flight->arr_airport_id = strtoupper(trim($flight->arr_airport_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Flight $flight
|
||||
*/
|
||||
public function updating(Flight $flight): void
|
||||
{
|
||||
$flight->dpt_airport_id = strtoupper(trim($flight->dpt_airport_id));
|
||||
$flight->arr_airport_id = strtoupper(trim($flight->arr_airport_id));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user