2018-03-06 02:21:38 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class SubfleetExpense
|
|
|
|
* @package App\Models
|
|
|
|
*/
|
|
|
|
class SubfleetExpense extends BaseModel
|
|
|
|
{
|
|
|
|
public $table = 'subfleet_expenses';
|
|
|
|
|
|
|
|
public $fillable = [
|
|
|
|
'subfleet_id',
|
|
|
|
'name',
|
|
|
|
'amount',
|
2018-03-06 09:55:48 +08:00
|
|
|
'type',
|
2018-03-06 02:21:38 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The attributes that should be casted to native types.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $casts = [
|
|
|
|
'amount' => 'float',
|
2018-03-06 09:55:48 +08:00
|
|
|
'type' => 'integer',
|
2018-03-06 02:21:38 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
public static $rules = [
|
|
|
|
'name' => 'required',
|
|
|
|
'amount' => 'required|numeric',
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Relationships
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Has a subfleet
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
*/
|
|
|
|
public function subfleet()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Subfleet::class, 'subfleet_id');
|
|
|
|
}
|
|
|
|
}
|