ConfigSave.php 2.4 KB

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