'float', 'longitude_deg' => 'float', 'elevation_ft' => 'integer', 'active' => 'boolean', ]; protected $appends = [ 'display_code', 'display_name', ]; const array LONDON_AIRPORTS = [ 'LHR', 'LGW', 'STN', 'LTN', 'LCY', 'SEN', ]; protected function displayName() : Attribute{ return Attribute::make( get: function () { $codes = array_filter([$this->iata_code, $this->icao_code]); $codeString = count($codes) ? ' (' . implode('/', $codes) . ')' : ''; return "{$this->municipality} / {$this->name}{$codeString}"; } ); } protected function displayCode(): Attribute { return Attribute::make( get: fn () => $this->iata_code ?? $this->icao_code ?? $this->local_code ?? '---' ); } public function scopeActive($query) { return $query->where('active', true); } public function region(): BelongsTo { return $this->belongsTo(Region::class); } }