phpvms/app/Models/Rank.php

44 lines
1000 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',
'acars_base_pay_rate',
'manual_base_pay_rate',
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',
2018-02-27 07:56:30 +08:00
'base_pay_rate' => 'float',
2017-12-31 04:37:10 +08:00
'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',
'acars_base_pay_rate' => 'nullable|numeric',
'manual_base_pay_rate' => 'nullable|numeric',
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
}