phpvms/app/Models/Aircraft.php

51 lines
850 B
PHP
Raw Normal View History

2017-06-09 09:37:51 +08:00
<?php
namespace App\Models;
class Aircraft extends BaseModel
2017-06-09 09:37:51 +08:00
{
public $table = 'aircraft';
public $fillable = [
'subfleet_id',
'airport_id',
'name',
'icao',
'registration',
'tail_number',
'active',
];
2017-06-09 09:37:51 +08:00
/**
* The attributes that should be casted to native types.
*
* @var array
*/
protected $casts = [
'active' => 'boolean',
];
2017-06-09 09:37:51 +08:00
/**
* Validation rules
*
* @var array
*/
public static $rules = [
'name' => 'required',
];
/**
* foreign keys
*/
2017-06-29 08:56:10 +08:00
2017-06-25 03:00:56 +08:00
public function airport()
{
return $this->belongsTo('App\Models\Airport', 'airport_id');
}
2017-06-10 14:50:00 +08:00
public function subfleet()
{
return $this->belongsTo('App\Models\Subfleet', 'subfleet_id');
2017-06-10 14:50:00 +08:00
}
2017-06-09 09:37:51 +08:00
}