check() and $this->ajax(); } /** * Prepare the data for validation. * * @return void */ protected function prepareForValidation() { $this->merge([ 'url' => strval($this->url), 'type' => intval($this->type) ]); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'type' => ['required', new EnumIsValidRule(ContactType::class)], 'url' => 'nullable|url', 'message' => 'required|string|min:20' ]; } }