Cleanup the cancelled PIREP logic
This commit is contained in:
@@ -12,11 +12,16 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName;
|
||||
/**
|
||||
* Class Acars
|
||||
* @param string id
|
||||
* @property mixed gs
|
||||
* @property mixed lat
|
||||
* @property mixed lon
|
||||
* @property mixed altitude
|
||||
* @property mixed heading
|
||||
* @property string pirep_id
|
||||
* @property int type
|
||||
* @property string name
|
||||
* @property double lat
|
||||
* @property double lon
|
||||
* @property double altitude
|
||||
* @property int gs
|
||||
* @property int heading
|
||||
* @property int order
|
||||
* @property int nav_type
|
||||
* @package App\Models
|
||||
*/
|
||||
class Acars extends Model
|
||||
@@ -64,15 +69,15 @@ class Acars extends Model
|
||||
'fuel' => 'float',
|
||||
'fuel_flow' => 'float',
|
||||
];
|
||||
/*public static $sanitize = [
|
||||
'sim_time' => 'carbon',
|
||||
'created_at' => '',
|
||||
];*/
|
||||
|
||||
public static $rules = [
|
||||
'pirep_id' => 'required',
|
||||
];
|
||||
|
||||
/*public static $sanitize = [
|
||||
'sim_time' => 'carbon',
|
||||
'created_at' => '',
|
||||
];*/
|
||||
|
||||
/**
|
||||
* Return a new Length unit so conversions can be made
|
||||
|
||||
@@ -33,8 +33,9 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName;
|
||||
* @property integer block_time
|
||||
* @property integer flight_time In minutes
|
||||
* @property integer planned_flight_time
|
||||
* @property mixed planned_distance
|
||||
* @property mixed distance
|
||||
* @property double distance
|
||||
* @property double planned_distance
|
||||
* @property string route
|
||||
* @property integer score
|
||||
* @property User user
|
||||
* @property Flight|null flight
|
||||
@@ -361,6 +362,14 @@ class Pirep extends Model
|
||||
$this->attributes['route'] = $route;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if this is cancelled or not
|
||||
*/
|
||||
public function getCancelledAttribute()
|
||||
{
|
||||
return $this->state === PirepState::CANCELLED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this PIREP is allowed to be updated
|
||||
* @return bool
|
||||
|
||||
Reference in New Issue
Block a user