ConfigSave.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. namespace App\Http\Requests\Admin;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class ConfigSave extends FormRequest
  5. {
  6. CONST RULES = [
  7. // invite & commission
  8. 'safe_mode_enable' => 'in:0,1',
  9. 'invite_force' => 'in:0,1',
  10. 'invite_commission' => 'integer',
  11. 'invite_gen_limit' => 'integer',
  12. 'invite_never_expire' => 'in:0,1',
  13. 'commission_first_time_enable' => 'in:0,1',
  14. // site
  15. 'stop_register' => 'in:0,1',
  16. 'email_verify' => 'in:0,1',
  17. 'app_name' => '',
  18. 'app_description' => '',
  19. 'app_url' => 'nullable|url',
  20. 'subscribe_url' => 'nullable|url',
  21. 'try_out_enable' => 'in:0,1',
  22. 'try_out_plan_id' => 'integer',
  23. 'try_out_hour' => 'numeric',
  24. 'email_whitelist_enable' => 'in:0,1',
  25. 'email_whitelist_suffix' => '',
  26. // subscribe
  27. 'plan_change_enable' => 'in:0,1',
  28. 'reset_traffic_method' => 'in:0,1',
  29. 'renew_reset_traffic_enable' => 'in:0,1',
  30. // server
  31. 'server_token' => 'nullable|min:16',
  32. 'server_license' => 'nullable',
  33. // alipay
  34. 'alipay_enable' => 'in:0,1',
  35. 'alipay_appid' => 'nullable|integer|min:16',
  36. 'alipay_pubkey' => 'max:2048',
  37. 'alipay_privkey' => 'max:2048',
  38. // stripe
  39. 'stripe_alipay_enable' => 'in:0,1',
  40. 'stripe_wepay_enable' => 'in:0,1',
  41. 'stripe_sk_live' => '',
  42. 'stripe_pk_live' => '',
  43. 'stripe_webhook_key' => '',
  44. 'stripe_currency' => 'in:hkd,usd,sgd',
  45. // bitpayx
  46. 'bitpayx_enable' => 'in:0,1',
  47. 'bitpayx_appsecret' => '',
  48. // paytaro
  49. 'paytaro_enable' => 'in:0,1',
  50. 'paytaro_app_id' => '',
  51. 'paytaro_app_secret' => '',
  52. // frontend
  53. 'frontend_theme_sidebar' => 'in:dark,light',
  54. 'frontend_theme_header' => 'in:dark,light',
  55. 'frontend_theme_color' => 'in:default,darkblue,black',
  56. 'frontend_background_url' => 'nullable|url',
  57. // tutorial
  58. 'apple_id' => 'email',
  59. 'apple_id_password' => ''
  60. ];
  61. /**
  62. * Get the validation rules that apply to the request.
  63. *
  64. * @return array
  65. */
  66. public function rules()
  67. {
  68. return self::RULES;
  69. }
  70. public function messages()
  71. {
  72. // illiteracy prompt
  73. return [
  74. 'app_url.url' => '站点URL格式不正确,必须携带http(s)://',
  75. 'subscribe_url.url' => '订阅URL格式不正确,必须携带http(s)://'
  76. ];
  77. }
  78. }