> */ public function rules(): array { return [ 'vip_payment_enabled' => ['required', 'in:0,1'], 'vip_payment_base_url' => ['nullable', 'url', 'max:255', 'required_if:vip_payment_enabled,1'], 'vip_payment_app_key' => ['nullable', 'string', 'max:100', 'required_if:vip_payment_enabled,1'], 'vip_payment_app_secret' => ['nullable', 'string', 'max:255', 'required_if:vip_payment_enabled,1'], 'vip_payment_timeout' => ['nullable', 'integer', 'min:3', 'max:30'], ]; } /** * 获取中文错误提示 * * @return array */ public function messages(): array { return [ 'vip_payment_enabled.required' => '请先选择是否启用 VIP 支付', 'vip_payment_base_url.required_if' => '启用 VIP 支付时,支付中心地址不能为空', 'vip_payment_base_url.url' => '支付中心地址格式不正确', 'vip_payment_app_key.required_if' => '启用 VIP 支付时,App Key 不能为空', 'vip_payment_app_secret.required_if' => '启用 VIP 支付时,App Secret 不能为空', 'vip_payment_timeout.integer' => '请求超时时间必须是整数', 'vip_payment_timeout.min' => '请求超时时间不能小于 3 秒', 'vip_payment_timeout.max' => '请求超时时间不能大于 30 秒', ]; } }