phpvms/app/Models/Acars.php

87 lines
1.8 KiB
PHP
Raw Normal View History

<?php
namespace App\Models;
use App\Contracts\Model;
use App\Models\Casts\DistanceCast;
use App\Models\Casts\FuelCast;
use App\Models\Traits\HashIdTrait;
use Illuminate\Database\Eloquent\Factories\HasFactory;
/**
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
*/
class Acars extends Model
{
use HashIdTrait;
use HasFactory;
public $table = 'acars';
protected $keyType = 'string';
2018-01-01 04:20:52 +08:00
public $incrementing = false;
public $fillable = [
2018-12-27 23:35:40 +08:00
'id',
'pirep_id',
'type',
'nav_type',
'order',
'name',
'status',
2017-12-26 08:22:46 +08:00
'log',
'lat',
'lon',
'distance',
2017-12-26 08:22:46 +08:00
'heading',
'altitude',
'vs',
'gs',
'transponder',
'autopilot',
'fuel_flow',
'sim_time',
'created_at',
'updated_at',
];
2017-12-26 08:10:24 +08:00
public $casts = [
'type' => 'integer',
'order' => 'integer',
'nav_type' => 'integer',
'lat' => 'float',
'lon' => 'float',
'distance' => DistanceCast::class,
'heading' => 'integer',
'altitude' => 'float',
'vs' => 'float',
'gs' => 'float',
'transponder' => 'integer',
'fuel' => FuelCast::class,
'fuel_flow' => 'float',
2017-12-26 08:10:24 +08:00
];
2018-01-01 04:20:52 +08:00
public static $rules = [
'pirep_id' => 'required',
2018-01-01 04:20:52 +08:00
];
/**
* FKs
*/
public function pirep()
{
2018-01-08 23:22:12 +08:00
return $this->belongsTo(Pirep::class, 'pirep_id');
}
}