From 2a7469d8984e7905c72cf16e4c72c6e7dc38fd00 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 25 Jan 2017 04:52:47 -0800 Subject: [PATCH] Fix uniqueness issue on saving edited fields --- app/Http/Controllers/CustomFieldsController.php | 3 +-- app/Models/CustomField.php | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/CustomFieldsController.php b/app/Http/Controllers/CustomFieldsController.php index 4e3d6df397..1fb81928d5 100644 --- a/app/Http/Controllers/CustomFieldsController.php +++ b/app/Http/Controllers/CustomFieldsController.php @@ -186,8 +186,7 @@ class CustomFieldsController extends Controller $validator = Validator::make(Input::all(), $field->rules); - if ($validator->passes()) { - $field->save(); + if ($field->save()) { return redirect()->route("fields.index")->with("success", trans('admin/custom_fields/message.field.update.success')); } diff --git a/app/Models/CustomField.php b/app/Models/CustomField.php index 6dfa86fdef..36da4399ce 100644 --- a/app/Models/CustomField.php +++ b/app/Models/CustomField.php @@ -3,9 +3,12 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; use Schema; +use Watson\Validating\ValidatingTrait; +use App\Http\Traits\UniqueUndeletedTrait; class CustomField extends Model { + use ValidatingTrait, UniqueUndeletedTrait; public $guarded=["id"]; public static $PredefinedFormats=[ "ANY" => "",