2017-06-22 01:10:25 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2019-07-16 03:44:31 +08:00
|
|
|
use App\Contracts\Model;
|
2018-03-20 09:50:40 +08:00
|
|
|
|
2017-06-22 01:10:25 +08:00
|
|
|
/**
|
2019-08-02 03:23:59 +08:00
|
|
|
* @property string name
|
|
|
|
* @property int hours
|
|
|
|
* @property float manual_base_pay_rate
|
|
|
|
* @property float acars_base_pay_rate
|
2019-08-09 00:50:43 +08:00
|
|
|
* @property bool auto_promote
|
2019-09-17 01:08:26 +08:00
|
|
|
* @property bool auto_approve_acars
|
|
|
|
* @property bool auto_approve_manual
|
2017-06-22 01:10:25 +08:00
|
|
|
*/
|
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',
|
|
|
|
'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
|
|
|
}
|