|
|
|
@ -11,8 +11,6 @@ use App\Support\Units\Distance;
|
|
|
|
|
use App\Support\Units\Fuel;
|
|
|
|
|
use Carbon\Carbon;
|
|
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
|
use PhpUnitsOfMeasure\Exception\NonNumericValue;
|
|
|
|
|
use PhpUnitsOfMeasure\Exception\NonStringUnitName;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class Pirep
|
|
|
|
@ -198,33 +196,6 @@ class Pirep extends Model
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return a new Length unit so conversions can be made
|
|
|
|
|
*
|
|
|
|
|
* @param mixed $value
|
|
|
|
|
*
|
|
|
|
|
* @return int|Distance
|
|
|
|
|
*/
|
|
|
|
|
/*public function getDistanceAttribute()
|
|
|
|
|
{
|
|
|
|
|
if (!array_key_exists('distance', $this->attributes)) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
$distance = (float) $this->attributes['distance'];
|
|
|
|
|
if ($this->skip_mutator) {
|
|
|
|
|
return $distance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new Distance($distance, config('phpvms.internal_units.distance'));
|
|
|
|
|
} catch (NonNumericValue $e) {
|
|
|
|
|
return 0;
|
|
|
|
|
} catch (NonStringUnitName $e) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the distance unit, convert to our internal default unit
|
|
|
|
|
*
|
|
|
|
@ -249,52 +220,6 @@ class Pirep extends Model
|
|
|
|
|
return \in_array($this->state, static::$read_only_states, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return a new Fuel unit so conversions can be made
|
|
|
|
|
*
|
|
|
|
|
* @return int|Fuel
|
|
|
|
|
*/
|
|
|
|
|
/*public function getFuelUsedAttribute()
|
|
|
|
|
{
|
|
|
|
|
if (!array_key_exists('fuel_used', $this->attributes)) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
$fuel_used = (float) $this->attributes['fuel_used'];
|
|
|
|
|
|
|
|
|
|
return new Fuel($fuel_used, config('phpvms.internal_units.fuel'));
|
|
|
|
|
} catch (NonNumericValue $e) {
|
|
|
|
|
return 0;
|
|
|
|
|
} catch (NonStringUnitName $e) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return the planned_distance in a converter class
|
|
|
|
|
*
|
|
|
|
|
* @return int|Distance
|
|
|
|
|
*/
|
|
|
|
|
/*public function getPlannedDistanceAttribute()
|
|
|
|
|
{
|
|
|
|
|
if (!array_key_exists('planned_distance', $this->attributes)) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
$distance = (float) $this->attributes['planned_distance'];
|
|
|
|
|
if ($this->skip_mutator) {
|
|
|
|
|
return $distance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new Distance($distance, config('phpvms.internal_units.distance'));
|
|
|
|
|
} catch (NonNumericValue $e) {
|
|
|
|
|
return 0;
|
|
|
|
|
} catch (NonStringUnitName $e) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return the flight progress in a percent.
|
|
|
|
|