phpvms/app/Models/Rank.php

39 lines
788 B
PHP
Raw Normal View History

2017-06-22 01:10:25 +08:00
<?php
namespace App\Models;
/**
2018-02-07 04:09:20 +08:00
* Class Rank
2017-06-22 01:10:25 +08:00
* @package App\Models
*/
class Rank extends BaseModel
2017-06-22 01:10:25 +08:00
{
2017-06-22 02:44:30 +08:00
public $table = 'ranks';
2017-06-22 01:10:25 +08:00
public $fillable = [
'name',
'hours',
'image_link',
2017-06-22 01:10:25 +08:00
'auto_approve_acars',
'auto_approve_manual',
'auto_promote',
2017-06-22 01:10:25 +08:00
];
protected $casts = [
2017-12-31 04:37:10 +08:00
'hours' => 'integer',
'auto_approve_acars' => 'bool',
'auto_approve_manual' => 'bool',
2017-12-31 04:37:10 +08:00
'auto_promote' => 'bool',
2017-06-22 01:10:25 +08:00
];
public static $rules = [
'name' => 'required',
'hours' => 'required|integer',
2017-06-22 01:10:25 +08:00
];
public function subfleets() {
2018-01-08 23:22:12 +08:00
return $this->belongsToMany(Subfleet::class, 'subfleet_rank')
2017-12-31 04:37:10 +08:00
->withPivot('acars_pay', 'manual_pay');
}
2017-06-22 01:10:25 +08:00
}