Skip to content

A free open source IT asset/license management system

Added model validation to custom fieldsets

snipe6b5a0983eec0
diff --git a/app/Models/CustomFieldset.php b/app/Models/CustomFieldset.php
index 62b2f1a2e8..c89d3dd312 100644
--- a/app/Models/CustomFieldset.php
+++ b/app/Models/CustomFieldset.php
@@ -3,6 +3,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Gate;
+use Watson\Validating\ValidatingTrait;
class CustomFieldset extends Model
{
@@ -12,6 +13,17 @@ class CustomFieldset extends Model
"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()
{
return $this->belongsToMany('\App\Models\CustomField')->withPivot(["required","order"])->orderBy("pivot_order");