Added casts properties to all models, re-ordered model properties. Fixes #916

This commit is contained in:
James Brooks
2015-08-22 15:57:53 +01:00
parent 92192232ed
commit a77efc12e0
15 changed files with 182 additions and 94 deletions

View File

@@ -23,18 +23,29 @@ class Incident extends Model implements HasPresenter
use SoftDeletes, ValidatingTrait;
/**
* The validation rules.
* The accessors to append to the model's serialized form.
*
* @var string[]
*/
public $rules = [
'component_id' => 'integer',
'name' => 'required',
'status' => 'required|integer',
'visible' => 'required|boolean',
'message' => 'required',
protected $appends = ['human_status'];
/**
* The attributes that should be casted to native types.
*
* @var string[]
*/
protected $casts = [
'id' => 'int',
'visible' => 'integer',
];
/**
* The attributes that should be mutated to dates.
*
* @var string[]
*/
protected $dates = ['scheduled_at', 'deleted_at'];
/**
* The fillable properties.
*
@@ -52,26 +63,16 @@ class Incident extends Model implements HasPresenter
];
/**
* The accessors to append to the model's serialized form.
* The validation rules.
*
* @var string[]
*/
protected $appends = ['human_status'];
/**
* The attributes that should be mutated to dates.
*
* @var string[]
*/
protected $dates = ['scheduled_at', 'deleted_at'];
/**
* The attributes that should be casted to native types.
*
* @var string[]
*/
protected $casts = [
'visible' => 'integer',
public $rules = [
'component_id' => 'integer',
'name' => 'required',
'status' => 'required|integer',
'visible' => 'required|boolean',
'message' => 'required',
];
/**