'integer', 'mtow' => 'float', 'zfw' => 'float', 'flight_time' => 'float', 'state' => 'integer', ]; /** * Validation rules */ public static $rules = [ 'subfleet_id' => 'required', 'name' => 'required', 'status' => 'required', 'registration' => 'required', 'mtow' => 'nullable|number', 'zfw' => 'nullable|number', ]; /** * See if this aircraft is active * * @return bool */ public function getActiveAttribute(): bool { return $this->status === AircraftStatus::ACTIVE; } /** * Capitalize the ICAO when set * * @param $icao */ public function setIcaoAttribute($icao): void { $this->attributes['icao'] = strtoupper($icao); } /** * foreign keys */ public function airport() { return $this->belongsTo(Airport::class, 'airport_id'); } public function subfleet() { return $this->belongsTo(Subfleet::class, 'subfleet_id'); } }