phpvms/app/Models/Rank.php

58 lines
1.3 KiB
PHP
Raw Normal View History

2017-06-22 01:10:25 +08:00
<?php
namespace App\Models;
use App\Contracts\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
2017-06-22 01:10:25 +08:00
/**
* @property string name
* @property int hours
* @property float manual_base_pay_rate
* @property float acars_base_pay_rate
* @property bool auto_promote
* @property bool auto_approve_acars
* @property bool auto_approve_manual
2017-06-22 01:10:25 +08:00
*/
class Rank extends Model
2017-06-22 01:10:25 +08:00
{
use HasFactory;
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',
'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
}