diff --git a/app/Http/Requests/CustomFieldRequest.php b/app/Http/Requests/CustomFieldRequest.php index f1f09e40db..c6d661c4fa 100644 --- a/app/Http/Requests/CustomFieldRequest.php +++ b/app/Http/Requests/CustomFieldRequest.php @@ -3,6 +3,7 @@ namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; +use Illuminate\Http\Request; class CustomFieldRequest extends FormRequest { @@ -21,11 +22,26 @@ class CustomFieldRequest extends FormRequest * * @return array */ - public function rules() + public function rules(Request $request) { - return [ - "name" => "required|unique:custom_fields", - "custom_format" => "valid_regex", - ]; + + $rules = []; + + switch($this->method()) + { + + // Brand new + case 'POST': + { + $rules['name'] = "required|unique:custom_fields"; + break; + } + + default:break; + } + + $rules['custom_format'] = 'valid_regex'; + + return $rules; } }