route('customer'); return [ 'email' => "email|unique:customers,email,". $customer->crm_id .",crm_id|required", 'country' => 'string|required' ]; } protected function failedValidation(Validator $validator) { if ($this->wantsJson()) { throw new HttpResponseException(response()->json(new StatusResource([ 'status' => 'KO', 'code' => 422, 'message' => $validator->errors()->messages() ]), 422)); } } }