ConfigSave.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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,eur,gbp',
  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. // email
  61. 'email_template' => ''
  62. ];
  63. /**
  64. * Get the validation rules that apply to the request.
  65. *
  66. * @return array
  67. */
  68. public function rules()
  69. {
  70. return self::RULES;
  71. }
  72. public function messages()
  73. {
  74. // illiteracy prompt
  75. return [
  76. 'app_url.url' => '站点URL格式不正确,必须携带http(s)://',
  77. 'subscribe_url.url' => '订阅URL格式不正确,必须携带http(s)://'
  78. ];
  79. }
  80. }