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,16 +23,37 @@ class Component extends Model implements HasPresenter
use SoftDeletes, ValidatingTrait;
/**
* The validation rules.
* List of attributes that have default values.
*
* @var mixed[]
*/
protected $attributes = [
'order' => 0,
'group_id' => 0,
'description' => '',
'link' => '',
];
/**
* The attributes that should be casted to native types.
*
* @var string[]
*/
public $rules = [
'name' => 'required|string',
'status' => 'integer|required',
'link' => 'url',
protected $casts = [
'id' => 'int',
'order' => 'int',
'group_id' => 'int',
'description' => 'string',
'link' => 'string',
];
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = ['deleted_at'];
/**
* The fillable properties.
*
@@ -49,24 +70,16 @@ class Component extends Model implements HasPresenter
];
/**
* List of attributes that have default values.
* The validation rules.
*
* @var mixed[]
* @var string[]
*/
protected $attributes = [
'order' => 0,
'group_id' => 0,
'description' => '',
'link' => '',
public $rules = [
'name' => 'required|string',
'status' => 'integer|required',
'link' => 'url',
];
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = ['deleted_at'];
/**
* Components can belong to a group.
*