merge(['user_id' => (int) ($this->input('user_id') ?? 0)]); } public function rules(): array { return [ 'user_id' => 'required|integer|min:0', 'type' => 'required|string|in:order,price,system', 'title' => 'required|string|max:100', 'content' => 'nullable|string|max:500', ]; } public function messages(): array { return [ 'type.required' => '通知类型不能为空', 'type.in' => '通知类型只能是 order/price/system', 'title.required' => '通知标题不能为空', 'title.max' => '通知标题最长 100 个字符', 'content.max' => '通知内容最长 500 个字符', ]; } }