phpvms/app/Models/Aircraft.php

67 lines
1.2 KiB
PHP
Raw Normal View History

2017-06-09 09:37:51 +08:00
<?php
namespace App\Models;
use Eloquent as Model;
/**
* Class Aircraft
*
2017-06-09 09:37:51 +08:00
* @package App\Models
* @version June 9, 2017, 1:06 am UTC
*/
class Aircraft extends Model
{
public $table = 'aircraft';
2017-06-09 09:37:51 +08:00
protected $dates = ['deleted_at'];
public $fillable
= [
'subfleet_id',
2017-06-25 03:00:56 +08:00
'airport_id',
'name',
'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
= [
2017-06-25 03:00:56 +08:00
'subfleet_id' => 'string',
'name' => 'string',
'registration' => 'string',
'active' => 'boolean',
];
2017-06-09 09:37:51 +08:00
/**
* Validation rules
*
* @var array
*/
public static $rules
= [
'name' => 'required',
'active' => '',
];
/**
* 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
}