phpvms/app/Models/Fare.php

48 lines
789 B
PHP
Raw Normal View History

<?php
namespace App\Models;
/**
* Class Fare
*
* @package App\Models
*/
class Fare extends BaseModel
{
public $table = 'fares';
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',
];
/**
* any foreign keys
*/
2017-06-25 00:09:27 +08:00
public function subfleets() {
return $this->belongsToMany(
2017-06-25 00:09:27 +08:00
'App\Models\Subfleet',
'subfleet_fare'
)->withPivot('price', 'cost', 'capacity');
}
}