2017-06-22 01:10:25 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class Ranking
|
|
|
|
* @package App\Models
|
|
|
|
*/
|
2017-12-26 05:19:34 +08:00
|
|
|
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',
|
|
|
|
'auto_approve_acars',
|
|
|
|
'auto_approve_manual',
|
|
|
|
'auto_promote'
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The attributes that should be casted to native types.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $casts = [
|
|
|
|
'name' => 'string',
|
2017-06-22 09:18:01 +08:00
|
|
|
'hours' => 'integer',
|
2017-12-26 05:19:34 +08:00
|
|
|
'auto_approve_acars' => 'bool',
|
|
|
|
'auto_approve_manual' => 'bool',
|
|
|
|
'auto_promote' => 'bool',
|
2017-06-22 01:10:25 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Validation rules
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
public static $rules = [
|
2017-07-03 04:03:25 +08:00
|
|
|
'name' => 'required|unique:ranks',
|
|
|
|
'hours' => 'required',
|
2017-06-22 01:10:25 +08:00
|
|
|
];
|
2017-06-23 09:55:45 +08:00
|
|
|
|
|
|
|
public function subfleets() {
|
|
|
|
return $this->belongsToMany(
|
|
|
|
'App\Models\Subfleet',
|
|
|
|
'subfleet_rank'
|
|
|
|
)->withPivot('acars_pay', 'manual_pay');
|
|
|
|
}
|
2017-06-22 01:10:25 +08:00
|
|
|
}
|