'string|exists:campagne,camp_id|required', 'hashcode' => 'string|exists:customers,hashcode|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)); } } }