ConfigSave.php 3.2 KB

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