merge([ 'font_name' => $this->input('font_name'), 'font' => $this->input('font') ]); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules(): array { return [ 'font_name' => [ 'present', 'required_without:font', 'nullable', // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed function (string $attribute, $value, callable $fail) { $font = $this->input('font'); if (is_null($font) and !in_array($value, Font::DEFAULT_FONTS)) { $fail(trans('validation.in_array', [ 'other' => implode(',', Font::DEFAULT_FONTS) ])); } } ], 'font' => 'present|nullable' ]; } /** * Get custom attributes for validator errors. * * @return array */ public function attributes(): array { return [ 'font_name' => trans('validation.attributes.name'), 'font' => trans('validation.custom.font'), ]; } }