phpvms/app/Models/Observers/AircraftObserver.php
2018-08-26 18:51:47 +00:00

25 lines
407 B
PHP

<?php
namespace App\Models\Observers;
use App\Models\Aircraft;
use App\Support\ICAO;
/**
* Class AircraftObserver
*/
class AircraftObserver
{
/**
* @param Aircraft $aircraft
*
* @throws \Exception
*/
public function creating(Aircraft $aircraft): void
{
if (empty($aircraft->hex_code)) {
$aircraft->hex_code = ICAO::createHexCode();
}
}
}