Skip to content

Commit

Permalink
Update Aircraft Model (Landing Time Attribute) (#1336)
Browse files Browse the repository at this point in the history
* Update Aircraft.php

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

* StyleFix
  • Loading branch information
FatihKoz committed Oct 25, 2021
1 parent 91d6830 commit 930d4cf
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/Models/Aircraft.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ public function setIcaoAttribute($icao): void
$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
*/
Expand Down

0 comments on commit 930d4cf

Please sign in to comment.