v2board/app/Http/Requests/Admin/ConfigSave.php

86 lines
2.5 KiB
PHP
Raw Normal View History

2019-10-29 15:33:36 +08:00
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class ConfigSave extends FormRequest
{
2020-01-04 17:27:21 +08:00
CONST RULES = [
// invite & commission
2020-02-08 16:38:03 +08:00
'safe_mode_enable' => 'in:0,1',
2020-01-31 17:18:00 +08:00
'invite_force' => 'in:0,1',
'invite_commission' => 'integer',
'invite_gen_limit' => 'integer',
'invite_never_expire' => 'in:0,1',
'commission_first_time_enable' => 'in:0,1',
// site
2020-01-31 17:18:00 +08:00
'stop_register' => 'in:0,1',
'email_verify' => 'in:0,1',
'app_name' => '',
2020-02-09 18:53:45 +08:00
'app_description' => '',
2020-03-02 17:58:07 +08:00
'app_url' => 'nullable|url',
'subscribe_url' => 'nullable|url',
2020-01-31 17:18:00 +08:00
'try_out_enable' => 'in:0,1',
'try_out_plan_id' => 'integer',
'try_out_hour' => 'numeric',
2020-02-09 17:17:21 +08:00
'email_whitelist_enable' => 'in:0,1',
2020-02-09 18:09:48 +08:00
'email_whitelist_suffix' => '',
2020-02-18 02:33:57 +08:00
// subscribe
'plan_change_enable' => 'in:0,1',
2020-03-02 00:04:07 +08:00
'reset_traffic_method' => 'in:0,1',
2020-03-02 00:14:58 +08:00
'renew_reset_traffic_enable' => 'in:0,1',
2020-01-04 17:27:21 +08:00
// server
2020-01-31 17:18:00 +08:00
'server_token' => 'nullable|min:16',
'server_license' => 'nullable',
2020-01-04 17:27:21 +08:00
// alipay
2020-01-31 17:18:00 +08:00
'alipay_enable' => 'in:0,1',
'alipay_appid' => 'nullable|integer|min:16',
'alipay_pubkey' => 'max:2048',
'alipay_privkey' => 'max:2048',
2020-01-04 17:27:21 +08:00
// stripe
2020-01-31 17:18:00 +08:00
'stripe_alipay_enable' => 'in:0,1',
'stripe_wepay_enable' => 'in:0,1',
'stripe_sk_live' => '',
'stripe_pk_live' => '',
'stripe_webhook_key' => '',
2020-03-31 01:46:33 +08:00
'stripe_currency' => 'in:hkd,usd,sgd,eur,gbp',
2020-01-04 17:27:21 +08:00
// bitpayx
2020-01-31 17:18:00 +08:00
'bitpayx_enable' => 'in:0,1',
'bitpayx_appsecret' => '',
2020-01-14 00:29:59 +08:00
// paytaro
2020-01-31 17:18:00 +08:00
'paytaro_enable' => 'in:0,1',
'paytaro_app_id' => '',
'paytaro_app_secret' => '',
2020-01-20 16:16:59 +08:00
// frontend
2020-02-17 03:35:03 +08:00
'frontend_theme_sidebar' => 'in:dark,light',
'frontend_theme_header' => 'in:dark,light',
2020-02-17 13:41:19 +08:00
'frontend_theme_color' => 'in:default,darkblue,black',
2020-01-31 17:18:00 +08:00
'frontend_background_url' => 'nullable|url',
2020-01-04 17:27:21 +08:00
// tutorial
2020-01-31 17:18:00 +08:00
'apple_id' => 'email',
2020-03-19 15:54:08 +08:00
'apple_id_password' => '',
// email
'email_template' => ''
2020-01-04 17:27:21 +08:00
];
2019-10-29 15:33:36 +08:00
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
2020-01-04 17:27:21 +08:00
return self::RULES;
2019-10-29 15:33:36 +08:00
}
2020-01-11 13:36:52 +08:00
2019-10-29 15:33:36 +08:00
public function messages()
{
2020-03-02 00:14:58 +08:00
// illiteracy prompt
2019-10-29 15:33:36 +08:00
return [
2020-03-02 00:14:58 +08:00
'app_url.url' => '站点URL格式不正确必须携带http(s)://',
'subscribe_url.url' => '订阅URL格式不正确必须携带http(s)://'
2019-10-29 15:33:36 +08:00
];
}
}