2017-12-20 10:19:36 +08:00
|
|
|
<?php
|
|
|
|
|
2017-12-26 05:19:34 +08:00
|
|
|
namespace App\Models;
|
2017-12-20 10:19:36 +08:00
|
|
|
|
2019-07-16 03:44:31 +08:00
|
|
|
use App\Contracts\Model;
|
2022-03-14 23:45:18 +08:00
|
|
|
use App\Models\Casts\DistanceCast;
|
|
|
|
use App\Models\Casts\FuelCast;
|
2018-03-08 22:51:36 +08:00
|
|
|
use App\Models\Traits\HashIdTrait;
|
2022-03-14 23:45:18 +08:00
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
2017-12-20 10:19:36 +08:00
|
|
|
|
2018-03-20 09:50:40 +08:00
|
|
|
/**
|
2020-04-01 05:26:55 +08:00
|
|
|
* @property string id
|
2018-05-12 01:08:55 +08:00
|
|
|
* @property string pirep_id
|
|
|
|
* @property int type
|
|
|
|
* @property string name
|
2020-04-01 05:26:55 +08:00
|
|
|
* @property float lat
|
|
|
|
* @property float lon
|
|
|
|
* @property float altitude
|
2018-05-12 01:08:55 +08:00
|
|
|
* @property int gs
|
|
|
|
* @property int heading
|
|
|
|
* @property int order
|
|
|
|
* @property int nav_type
|
2018-03-20 09:50:40 +08:00
|
|
|
*/
|
|
|
|
class Acars extends Model
|
2017-12-20 10:19:36 +08:00
|
|
|
{
|
2018-03-08 22:51:36 +08:00
|
|
|
use HashIdTrait;
|
2022-03-14 23:45:18 +08:00
|
|
|
use HasFactory;
|
2017-12-26 05:19:34 +08:00
|
|
|
|
2017-12-20 10:19:36 +08:00
|
|
|
public $table = 'acars';
|
2019-09-13 20:05:02 +08:00
|
|
|
|
|
|
|
protected $keyType = 'string';
|
2022-03-14 23:45:18 +08:00
|
|
|
|
2018-01-01 04:20:52 +08:00
|
|
|
public $incrementing = false;
|
2017-12-26 05:19:34 +08:00
|
|
|
|
|
|
|
public $fillable = [
|
2018-12-27 23:35:40 +08:00
|
|
|
'id',
|
2017-12-26 05:19:34 +08:00
|
|
|
'pirep_id',
|
2018-01-02 00:30:31 +08:00
|
|
|
'type',
|
2018-01-02 03:48:02 +08:00
|
|
|
'nav_type',
|
2018-01-02 23:40:42 +08:00
|
|
|
'order',
|
2018-01-02 03:48:02 +08:00
|
|
|
'name',
|
2018-05-04 04:06:50 +08:00
|
|
|
'status',
|
2017-12-26 08:22:46 +08:00
|
|
|
'log',
|
2017-12-26 05:19:34 +08:00
|
|
|
'lat',
|
|
|
|
'lon',
|
2018-05-04 04:06:50 +08:00
|
|
|
'distance',
|
2017-12-26 08:22:46 +08:00
|
|
|
'heading',
|
2017-12-26 05:19:34 +08:00
|
|
|
'altitude',
|
|
|
|
'vs',
|
|
|
|
'gs',
|
|
|
|
'transponder',
|
|
|
|
'autopilot',
|
|
|
|
'fuel_flow',
|
|
|
|
'sim_time',
|
2018-05-09 06:30:44 +08:00
|
|
|
'created_at',
|
|
|
|
'updated_at',
|
2017-12-26 05:19:34 +08:00
|
|
|
];
|
|
|
|
|
2017-12-26 08:10:24 +08:00
|
|
|
public $casts = [
|
2018-03-20 09:50:40 +08:00
|
|
|
'type' => 'integer',
|
|
|
|
'order' => 'integer',
|
|
|
|
'nav_type' => 'integer',
|
|
|
|
'lat' => 'float',
|
|
|
|
'lon' => 'float',
|
2022-03-14 23:45:18 +08:00
|
|
|
'distance' => DistanceCast::class,
|
2018-03-20 09:50:40 +08:00
|
|
|
'heading' => 'integer',
|
|
|
|
'altitude' => 'float',
|
|
|
|
'vs' => 'float',
|
|
|
|
'gs' => 'float',
|
|
|
|
'transponder' => 'integer',
|
2022-03-14 23:45:18 +08:00
|
|
|
'fuel' => FuelCast::class,
|
2018-03-20 09:50:40 +08:00
|
|
|
'fuel_flow' => 'float',
|
2017-12-26 08:10:24 +08:00
|
|
|
];
|
|
|
|
|
2018-01-01 04:20:52 +08:00
|
|
|
public static $rules = [
|
2018-03-20 09:50:40 +08:00
|
|
|
'pirep_id' => 'required',
|
2018-01-01 04:20:52 +08:00
|
|
|
];
|
|
|
|
|
2017-12-26 05:19:34 +08:00
|
|
|
/**
|
|
|
|
* FKs
|
|
|
|
*/
|
|
|
|
public function pirep()
|
|
|
|
{
|
2018-01-08 23:22:12 +08:00
|
|
|
return $this->belongsTo(Pirep::class, 'pirep_id');
|
2017-12-26 05:19:34 +08:00
|
|
|
}
|
2017-12-20 10:19:36 +08:00
|
|
|
}
|