> */ public function rules(): array { return [ 'word' => ['required', 'string', 'max:2048', function (string $attribute, mixed $value, \Closure $fail) { if (count(array_filter(explode(',', (string) $value), fn ($w) => trim($w) !== '')) > 50) { $fail(__('validation.max.array', ['attribute' => $attribute, 'max' => 50])); } }], 'tag' => ['sometimes', 'nullable', 'string', 'max:1024'], 'channel' => ['sometimes', 'uuid'], 'language' => ['sometimes', 'string', 'max:16'], // 查询串里是字符串:Laravel 的 boolean 规则不收 "true"/"false",取值处用 \$request->boolean() 'with_body' => ['sometimes', 'in:true,false,1,0'], 'page' => ['integer', 'min:1'], 'per_page' => ['integer', 'min:1', 'max:200'], ]; } }