'int', 'total_time' => 'int', 'active' => 'boolean', ]; /** * Validation rules * @var array */ public static $rules = [ 'country' => 'nullable', 'iata' => 'nullable|max:5', 'icao' => 'required|max:5', 'logo' => 'nullable', 'name' => 'required', ]; /** * For backwards compatibility */ public function getCodeAttribute() { if ($this->iata && $this->iata !== '') return $this->iata; else return $this->icao; } /** * Capitalize the IATA code when set * @param $iata */ public function setIataAttribute($iata) { $this->attributes['iata'] = strtoupper($iata); } /** * Capitalize the ICAO when set * @param $icao */ public function setIcaoAttribute($icao): void { $this->attributes['icao'] = strtoupper($icao); } }