Add unit conversion handling for block_fuel like for fuel_used (#1076)
* Add unit conversion handling for block_fuel like for fuel_used, add further checks in PIREPTest->testUnitFields * Remove accidentially added "use" Co-authored-by: Andreas Palm <ap@ewsp.de>
This commit is contained in:
@@ -326,6 +326,22 @@ class Pirep extends Model
|
||||
return $field_values;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the amount of block fuel
|
||||
*
|
||||
* @param $value
|
||||
*/
|
||||
public function setBlockFuelAttribute($value): void
|
||||
{
|
||||
if ($value instanceof Fuel) {
|
||||
$this->attributes['block_fuel'] = $value->toUnit(
|
||||
config('phpvms.internal_units.fuel')
|
||||
);
|
||||
} else {
|
||||
$this->attributes['block_fuel'] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the amount of fuel used
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user