ConfigSave.php 2.2 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' => '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. // server
  27. 'server_token' => 'nullable|min:16',
  28. 'server_license' => 'nullable',
  29. // alipay
  30. 'alipay_enable' => 'in:0,1',
  31. 'alipay_appid' => 'nullable|integer|min:16',
  32. 'alipay_pubkey' => 'max:2048',
  33. 'alipay_privkey' => 'max:2048',
  34. // stripe
  35. 'stripe_alipay_enable' => 'in:0,1',
  36. 'stripe_wepay_enable' => 'in:0,1',
  37. 'stripe_sk_live' => '',
  38. 'stripe_pk_live' => '',
  39. 'stripe_webhook_key' => '',
  40. // bitpayx
  41. 'bitpayx_enable' => 'in:0,1',
  42. 'bitpayx_appsecret' => '',
  43. // paytaro
  44. 'paytaro_enable' => 'in:0,1',
  45. 'paytaro_app_id' => '',
  46. 'paytaro_app_secret' => '',
  47. // frontend
  48. 'frontend_theme_sidebar' => 'in:dark,light',
  49. 'frontend_theme_header' => 'in:dark,light',
  50. 'frontend_theme_color' => 'in:default,darkblue,black',
  51. 'frontend_background_url' => 'nullable|url',
  52. // tutorial
  53. 'apple_id' => 'email',
  54. 'apple_id_password' => ''
  55. ];
  56. public static function filter()
  57. {
  58. return array_keys(self::RULES);
  59. }
  60. /**
  61. * Get the validation rules that apply to the request.
  62. *
  63. * @return array
  64. */
  65. public function rules()
  66. {
  67. return self::RULES;
  68. }
  69. public function messages()
  70. {
  71. return [
  72. ];
  73. }
  74. }