'required|string' ]; } /** * 获取已定义验证规则的错误消息 */ public function messages(): array { return [ 'code.required' => 'code不能为空', ]; } /** * 验证的各字段的含义 * @return array|string[] */ public function attributes(): array { return [ 'code' => 'code', ]; } }