2017-07-11 08:06:06 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2019-07-16 03:44:31 +08:00
|
|
|
use App\Contracts\Model;
|
2018-03-20 09:50:40 +08:00
|
|
|
|
2017-07-11 08:06:06 +08:00
|
|
|
/**
|
2018-03-21 02:06:06 +08:00
|
|
|
* Class FlightFieldValue
|
2018-08-27 00:40:04 +08:00
|
|
|
*
|
2018-03-21 02:47:47 +08:00
|
|
|
* @property string flight_id
|
|
|
|
* @property string name
|
|
|
|
* @property string value
|
2017-07-11 08:06:06 +08:00
|
|
|
*/
|
2018-03-21 02:06:06 +08:00
|
|
|
class FlightFieldValue extends Model
|
2017-07-11 08:06:06 +08:00
|
|
|
{
|
2018-03-21 02:06:06 +08:00
|
|
|
public $table = 'flight_field_values';
|
2017-07-11 08:06:06 +08:00
|
|
|
|
2018-03-21 08:40:19 +08:00
|
|
|
protected $fillable = [
|
2018-01-04 12:04:51 +08:00
|
|
|
'flight_id',
|
|
|
|
'name',
|
2018-05-31 03:00:20 +08:00
|
|
|
'slug',
|
2018-01-04 12:04:51 +08:00
|
|
|
'value',
|
|
|
|
];
|
2017-07-11 08:06:06 +08:00
|
|
|
|
|
|
|
public static $rules = [];
|
|
|
|
|
2018-05-31 03:00:20 +08:00
|
|
|
/**
|
|
|
|
* @param $name
|
|
|
|
*/
|
|
|
|
public function setNameAttribute($name): void
|
|
|
|
{
|
|
|
|
$this->attributes['name'] = $name;
|
|
|
|
$this->attributes['slug'] = str_slug($name);
|
|
|
|
}
|
|
|
|
|
2017-07-11 08:06:06 +08:00
|
|
|
/**
|
|
|
|
* Relationships
|
|
|
|
*/
|
|
|
|
public function flight()
|
|
|
|
{
|
2018-01-08 23:22:12 +08:00
|
|
|
return $this->belongsTo(Flight::class, 'flight_id');
|
2017-07-11 08:06:06 +08:00
|
|
|
}
|
|
|
|
}
|