2018-03-19 09:37:35 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models\Observers;
|
|
|
|
|
|
|
|
use App\Models\Aircraft;
|
|
|
|
use App\Support\ICAO;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class AircraftObserver
|
|
|
|
* @package App\Models\Observers
|
|
|
|
*/
|
|
|
|
class AircraftObserver
|
|
|
|
{
|
2018-03-20 09:50:40 +08:00
|
|
|
/**
|
|
|
|
* @param Aircraft $aircraft
|
|
|
|
*/
|
2018-03-19 09:37:35 +08:00
|
|
|
public function creating(Aircraft $aircraft): void
|
|
|
|
{
|
|
|
|
if (empty($aircraft->hex_code)) {
|
|
|
|
$aircraft->hex_code = ICAO::createHexCode();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|