I have a validation class:
class AnalyseRequest extends FormRequest
{
public function authorize()
{
return true;
}
public function rules()
{
'code' => 'required|code_format|unique:analyses',
}
}
The code field stores the code, which must be unique. There is a template where this code is displayed for editing. I edit other fields, I do not touch the code. I keep my form. Then this rule is triggered. Tell me please, how can I set up the validator so that it works correctly when this value is edited to a new one?