Fix block_off/on_time and fix the metar date parsing

This commit is contained in:
Nabeel Shahzad
2018-05-01 22:52:31 -05:00
parent b96f1cd7c4
commit 3a81e2ec27
5 changed files with 28 additions and 10 deletions

View File

@@ -157,7 +157,11 @@ class Pirep extends Model
*/
public function getBlockOffTimeAttribute()
{
return new Carbon($this->attributes['block_off_time']);
if (array_key_exists('block_off_time', $this->attributes)) {
return new Carbon($this->attributes['block_off_time']);
}
return null;
}
/**
@@ -166,7 +170,11 @@ class Pirep extends Model
*/
public function getBlockOnTimeAttribute()
{
return new Carbon($this->attributes['block_on_time']);
if (array_key_exists('block_on_time', $this->attributes)) {
return new Carbon($this->attributes['block_on_time']);
}
return null;
}
/**