2017-06-11 07:27:19 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class Fare
|
|
|
|
*
|
|
|
|
* @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';
|
|
|
|
|
|
|
|
protected $dates = ['deleted_at'];
|
|
|
|
|
2017-12-14 01:29:14 +08:00
|
|
|
public $fillable = [
|
|
|
|
'code',
|
|
|
|
'name',
|
|
|
|
'price',
|
|
|
|
'cost',
|
|
|
|
'capacity',
|
|
|
|
'notes',
|
|
|
|
'active',
|
|
|
|
];
|
|
|
|
|
|
|
|
protected $casts = [
|
|
|
|
'code' => 'string',
|
|
|
|
'name' => 'string',
|
|
|
|
'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() {
|
2017-06-11 07:27:19 +08:00
|
|
|
return $this->belongsToMany(
|
2017-06-25 00:09:27 +08:00
|
|
|
'App\Models\Subfleet',
|
|
|
|
'subfleet_fare'
|
2017-06-11 07:27:19 +08:00
|
|
|
)->withPivot('price', 'cost', 'capacity');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|