2017-06-11 07:27:19 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class Fare
|
2018-03-03 07:29:11 +08:00
|
|
|
* @property integer capacity
|
|
|
|
* @property float cost
|
|
|
|
* @property float price
|
|
|
|
* @property mixed code
|
2017-06-11 07:27:19 +08:00
|
|
|
* @package App\Models
|
|
|
|
*/
|
2017-12-26 05:19:34 +08:00
|
|
|
class Fare extends BaseModel
|
2017-06-11 07:27:19 +08:00
|
|
|
{
|
|
|
|
public $table = 'fares';
|
|
|
|
|
2017-12-14 01:29:14 +08:00
|
|
|
public $fillable = [
|
|
|
|
'code',
|
|
|
|
'name',
|
|
|
|
'price',
|
|
|
|
'cost',
|
|
|
|
'capacity',
|
|
|
|
'notes',
|
|
|
|
'active',
|
|
|
|
];
|
|
|
|
|
|
|
|
protected $casts = [
|
|
|
|
'price' => 'float',
|
|
|
|
'cost' => 'float',
|
|
|
|
'capacity' => 'integer',
|
|
|
|
'active' => 'boolean',
|
|
|
|
];
|
|
|
|
|
|
|
|
public static $rules = [
|
|
|
|
'code' => 'required',
|
|
|
|
'name' => 'required',
|
|
|
|
];
|
2017-06-11 07:27:19 +08:00
|
|
|
|
2017-06-23 09:55:45 +08:00
|
|
|
/**
|
|
|
|
* any foreign keys
|
|
|
|
*/
|
|
|
|
|
2017-06-25 00:09:27 +08:00
|
|
|
public function subfleets() {
|
2018-01-08 23:22:12 +08:00
|
|
|
return $this->belongsToMany(Subfleet::class, 'subfleet_fare')
|
|
|
|
->withPivot('price', 'cost', 'capacity');
|
2017-06-11 07:27:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|