phpvms/app/Models/Rank.php

54 lines
1.2 KiB
PHP
Raw Normal View History

2017-06-22 01:10:25 +08:00
<?php
namespace App\Models;
use App\Interfaces\Model;
2017-06-22 01:10:25 +08:00
/**
2018-02-07 04:09:20 +08:00
* Class Rank
* @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
*/
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',
'image_url',
'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 = [
'hours' => 'integer',
'base_pay_rate' => 'float',
'auto_approve_acars' => 'bool',
'auto_approve_manual' => 'bool',
'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
];
/*
* Relationships
*/
public function subfleets()
{
2018-01-08 23:22:12 +08:00
return $this->belongsToMany(Subfleet::class, 'subfleet_rank')
->withPivot('acars_pay', 'manual_pay');
}
2017-06-22 01:10:25 +08:00
}