Added model validation to custom fieldsets

This commit is contained in:
snipe 2017-07-12 19:34:45 -07:00
parent ad12a5ce11
commit 6b5a0983ee

View file

@ -3,6 +3,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Gate; use Gate;
use Watson\Validating\ValidatingTrait;
class CustomFieldset extends Model class CustomFieldset extends Model
{ {
@ -12,6 +13,17 @@ class CustomFieldset extends Model
"name" => "required|unique:custom_fieldsets" "name" => "required|unique:custom_fieldsets"
]; ];
/**
* Whether the model should inject it's identifier to the unique
* validation rules before attempting validation. If this property
* is not set in the model it will default to true.
*
* @var boolean
*/
protected $injectUniqueIdentifier = true;
use ValidatingTrait;
public function fields() public function fields()
{ {
return $this->belongsToMany('\App\Models\CustomField')->withPivot(["required","order"])->orderBy("pivot_order"); return $this->belongsToMany('\App\Models\CustomField')->withPivot(["required","order"])->orderBy("pivot_order");