From 930d4cfa0850bb629a2d6d200361772e448f1f99 Mon Sep 17 00:00:00 2001 From: "B.Fatih KOZ" Date: Mon, 25 Oct 2021 17:11:52 +0300 Subject: [PATCH] Update Aircraft Model (Landing Time Attribute) (#1336) * Update Aircraft.php Return `landing_time` attribute in Carbon format if it is not empty * StyleFix --- app/Models/Aircraft.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/Models/Aircraft.php b/app/Models/Aircraft.php index 87c0b1b9..be9f9ba3 100644 --- a/app/Models/Aircraft.php +++ b/app/Models/Aircraft.php @@ -100,6 +100,18 @@ class Aircraft extends Model $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 */