phpvms/app/Models/Observers/FlightObserver.php
Nabeel S 7a34756188
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
2019-10-23 12:01:31 -04:00

30 lines
676 B
PHP

<?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));
}
}