ConfigSave.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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' => 'url',
  17. 'subscribe_url' => '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. // bitpayx
  42. 'bitpayx_enable' => 'in:0,1',
  43. 'bitpayx_appsecret' => '',
  44. // paytaro
  45. 'paytaro_enable' => 'in:0,1',
  46. 'paytaro_app_id' => '',
  47. 'paytaro_app_secret' => '',
  48. // frontend
  49. 'frontend_theme_sidebar' => 'in:dark,light',
  50. 'frontend_theme_header' => 'in:dark,light',
  51. 'frontend_theme_color' => 'in:default,darkblue,black',
  52. 'frontend_background_url' => 'nullable|url',
  53. // tutorial
  54. 'apple_id' => 'email',
  55. 'apple_id_password' => ''
  56. ];
  57. /**
  58. * Get the validation rules that apply to the request.
  59. *
  60. * @return array
  61. */
  62. public function rules()
  63. {
  64. return self::RULES;
  65. }
  66. public function messages()
  67. {
  68. // illiteracy prompt
  69. return [
  70. 'app_url.url' => '站点URL格式不正确,必须携带http(s)://',
  71. 'subscribe_url.url' => '订阅URL格式不正确,必须携带http(s)://'
  72. ];
  73. }
  74. }