Update Aircraft Model (Landing Time Attribute) (#1336)

* Update Aircraft.php

Return `landing_time` attribute in Carbon format if it is not empty

* StyleFix
This commit is contained in:
B.Fatih KOZ 2021-10-25 17:11:52 +03:00 committed by GitHub
parent 91d68308aa
commit 930d4cfa08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,6 +100,18 @@ class Aircraft extends Model
$this->attributes['icao'] = strtoupper($icao); $this->attributes['icao'] = strtoupper($icao);
} }
/**
* Return the landing time in carbon format if provided
*
* @return Carbon|null
*/
public function getLandingTimeAttribute()
{
if (array_key_exists('landing_time', $this->attributes) && filled($this->attributes['landing_time'])) {
return new Carbon($this->attributes['landing_time']);
}
}
/** /**
* foreign keys * foreign keys
*/ */