2018-02-27 05:16:12 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
2018-03-20 09:50:40 +08:00
|
|
|
use App\Interfaces\Model;
|
2018-04-02 11:26:20 +08:00
|
|
|
use App\Models\Traits\ReferenceTrait;
|
2018-02-27 05:16:12 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class Expense
|
2018-03-20 09:50:40 +08:00
|
|
|
* @property int airline_id
|
|
|
|
* @property float amount
|
2018-03-03 07:29:11 +08:00
|
|
|
* @property string name
|
2018-04-02 03:32:01 +08:00
|
|
|
* @property string ref_model
|
|
|
|
* @property string ref_model_id
|
2018-02-27 05:16:12 +08:00
|
|
|
* @package App\Models
|
|
|
|
*/
|
2018-03-20 09:50:40 +08:00
|
|
|
class Expense extends Model
|
2018-02-27 05:16:12 +08:00
|
|
|
{
|
2018-04-02 11:26:20 +08:00
|
|
|
use ReferenceTrait;
|
|
|
|
|
2018-02-27 05:16:12 +08:00
|
|
|
public $table = 'expenses';
|
|
|
|
|
2018-03-21 08:40:19 +08:00
|
|
|
protected $fillable = [
|
2018-02-27 05:16:12 +08:00
|
|
|
'airline_id',
|
|
|
|
'name',
|
|
|
|
'amount',
|
|
|
|
'type',
|
|
|
|
'multiplier',
|
2018-03-07 07:15:42 +08:00
|
|
|
'charge_to_user',
|
2018-04-02 03:32:01 +08:00
|
|
|
'ref_model',
|
|
|
|
'ref_model_id',
|
2018-02-27 05:16:12 +08:00
|
|
|
'active',
|
|
|
|
];
|
|
|
|
|
|
|
|
public static $rules = [
|
2018-03-20 09:50:40 +08:00
|
|
|
'active' => 'boolean',
|
|
|
|
'airline_id' => 'integer',
|
|
|
|
'amount' => 'float',
|
|
|
|
'multiplier' => 'bool',
|
|
|
|
'charge_to_user' => 'bool',
|
2018-02-27 05:16:12 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Foreign Keys
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function airline()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Airline::class, 'airline_id');
|
|
|
|
}
|
|
|
|
}
|