|string> */ public function rules(): array { return [ 'q' => ['nullable', 'string', 'max:100'], 'perPage' => ['nullable', 'integer', 'min:1', 'max:50'], ]; } protected function passedValidation(): void { $this->merge([ 'perPage' => $this->perPage ?: 20, ]); } }