[Trim::class, TrimDuplicateSpaces::class, Capitalize::class], 'last_name' => [Trim::class, TrimDuplicateSpaces::class, Capitalize::class], 'email' => [Trim::class, RemoveSpaces::class, Lowercase::class], 'address' => [Trim::class, TrimDuplicateSpaces::class], 'city' => [Trim::class, TrimDuplicateSpaces::class], 'postcode' => [Trim::class], 'file' => [Trim::class], 'message' => [Trim::class], ]; /** * Determine if the user is authorized to make this request. * * @return boolean */ public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. * * @return array */ public function rules(): array { $countryList = ($this->currentCountry && $this->currentCountry->get('iso')) ? $this->currentCountry->get('iso') : implode(',', Country::getValidIsoAplha2Codes()); return [ 'first_name' => 'required|string|between:3,255', 'last_name' => 'required|string|between:3,255', 'email' => 'required|email:rfc,dns,spoof,filter|max:255', 'address' => 'sometimes|nullable|string|max:255', 'city' => 'sometimes|nullable|string|between:2,255', 'postcode' => ['sometimes', 'nullable', 'string', "postal_code:{$countryList}"], 'file' => 'sometimes|nullable|mimes:jpg,jpeg,png,pdf|max:5120', 'message' => 'required|string|min:3', 'brand_id' => 'required|integer|exists:brands,id', 'subject_id' => 'required|integer|exists:claim_subjects,id', 'customer_id' => 'sometimes|nullable|integer|exists:customers,id', ]; } }