phpvms/app/Models/Observers/AircraftObserver.php

25 lines
407 B
PHP
Raw Normal View History

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