2017-06-22 01:10:25 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2018-03-20 09:50:40 +08:00
|
|
|
use App\Interfaces\Model;
|
|
|
|
|
2017-06-22 01:10:25 +08:00
|
|
|
/**
|
2018-02-07 04:09:20 +08:00
|
|
|
* Class Rank
|
2018-03-20 09:50:40 +08:00
|
|
|
* @property int hours
|
2018-03-03 07:29:11 +08:00
|
|
|
* @property float manual_base_pay_rate
|
|
|
|
* @property float acars_base_pay_rate
|
2017-06-22 01:10:25 +08:00
|
|
|
* @package App\Models
|
|
|
|
*/
|
2018-03-20 09:50:40 +08:00
|
|
|
class Rank extends Model
|
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
|
|
|
|
2018-03-21 08:40:19 +08:00
|
|
|
protected $fillable = [
|
2017-06-22 01:10:25 +08:00
|
|
|
'name',
|
|
|
|
'hours',
|
2018-03-18 01:19:26 +08:00
|
|
|
'image_url',
|
2018-02-28 04:29:45 +08:00
|
|
|
'acars_base_pay_rate',
|
|
|
|
'manual_base_pay_rate',
|
2017-06-22 01:10:25 +08:00
|
|
|
'auto_approve_acars',
|
|
|
|
'auto_approve_manual',
|
2018-01-04 02:47:12 +08:00
|
|
|
'auto_promote',
|
2017-06-22 01:10:25 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
protected $casts = [
|
2018-03-20 09:50:40 +08:00
|
|
|
'hours' => 'integer',
|
|
|
|
'base_pay_rate' => 'float',
|
|
|
|
'auto_approve_acars' => 'bool',
|
2017-12-26 05:19:34 +08:00
|
|
|
'auto_approve_manual' => 'bool',
|
2018-03-20 09:50:40 +08:00
|
|
|
'auto_promote' => 'bool',
|
2017-06-22 01:10:25 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
public static $rules = [
|
2018-03-20 09:50:40 +08:00
|
|
|
'name' => 'required',
|
|
|
|
'hours' => 'required|integer',
|
|
|
|
'acars_base_pay_rate' => 'nullable|numeric',
|
2018-02-28 04:29:45 +08:00
|
|
|
'manual_base_pay_rate' => 'nullable|numeric',
|
2017-06-22 01:10:25 +08:00
|
|
|
];
|
2017-06-23 09:55:45 +08:00
|
|
|
|
2018-03-19 09:37:35 +08:00
|
|
|
/*
|
|
|
|
* Relationships
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function subfleets()
|
|
|
|
{
|
2018-01-08 23:22:12 +08:00
|
|
|
return $this->belongsToMany(Subfleet::class, 'subfleet_rank')
|
2018-03-19 09:37:35 +08:00
|
|
|
->withPivot('acars_pay', 'manual_pay');
|
2017-06-23 09:55:45 +08:00
|
|
|
}
|
2017-06-22 01:10:25 +08:00
|
|
|
}
|