e22d6d5996
* Refactoring simbrief fares and aircraft * Hide user full name/email * Sort PIREP fields desc; fix cargo counts * Change the sorting * Extra logs * Fix tests * Return fare information through the API * Style fixes * Test fix * Another test fix * More fixes * Set aircraft and fares in prefile * Formatting
59 lines
1.1 KiB
PHP
59 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Contracts\Model;
|
|
|
|
/**
|
|
* @property string name
|
|
* @property float cost
|
|
* @property float price
|
|
* @property int code
|
|
* @property int capacity
|
|
* @property int count Only when merged with pivot
|
|
* @property int type
|
|
* @property string notes
|
|
* @property bool active
|
|
*/
|
|
class Fare extends Model
|
|
{
|
|
public $table = 'fares';
|
|
|
|
protected $fillable = [
|
|
'id',
|
|
'code',
|
|
'name',
|
|
'type',
|
|
'price',
|
|
'cost',
|
|
'capacity',
|
|
'count',
|
|
'notes',
|
|
'active',
|
|
];
|
|
|
|
protected $casts = [
|
|
'price' => 'float',
|
|
'cost' => 'float',
|
|
'capacity' => 'integer',
|
|
'count' => 'integer',
|
|
'type' => 'integer',
|
|
'active' => 'boolean',
|
|
];
|
|
|
|
public static $rules = [
|
|
'code' => 'required',
|
|
'name' => 'required',
|
|
'type' => 'required',
|
|
];
|
|
|
|
/**
|
|
* any foreign keys
|
|
*/
|
|
public function subfleets()
|
|
{
|
|
return $this->belongsToMany(Subfleet::class, 'subfleet_fare')
|
|
->withPivot('price', 'cost', 'capacity');
|
|
}
|
|
}
|