ConfigSave.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. 'plan_transfer_hour' => 'numeric',
  19. 'plan_change_enable' => 'in:0,1',
  20. 'try_out_enable' => 'in:0,1',
  21. 'try_out_plan_id' => 'integer',
  22. 'try_out_hour' => 'numeric',
  23. 'email_whitelist_enable' => 'in:0,1',
  24. 'email_whitelist_suffix' => '',
  25. // server
  26. 'server_token' => 'nullable|min:16',
  27. 'server_license' => 'nullable',
  28. // alipay
  29. 'alipay_enable' => 'in:0,1',
  30. 'alipay_appid' => 'nullable|integer|min:16',
  31. 'alipay_pubkey' => 'max:2048',
  32. 'alipay_privkey' => 'max:2048',
  33. // stripe
  34. 'stripe_alipay_enable' => 'in:0,1',
  35. 'stripe_wepay_enable' => 'in:0,1',
  36. 'stripe_sk_live' => '',
  37. 'stripe_pk_live' => '',
  38. 'stripe_webhook_key' => '',
  39. // bitpayx
  40. 'bitpayx_enable' => 'in:0,1',
  41. 'bitpayx_appsecret' => '',
  42. // paytaro
  43. 'paytaro_enable' => 'in:0,1',
  44. 'paytaro_app_id' => '',
  45. 'paytaro_app_secret' => '',
  46. // frontend
  47. 'frontend_theme' => 'in:1,2',
  48. 'frontend_background_url' => 'nullable|url',
  49. // tutorial
  50. 'apple_id' => 'email',
  51. 'apple_id_password' => ''
  52. ];
  53. public static function filter()
  54. {
  55. return array_keys(self::RULES);
  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. return [
  69. ];
  70. }
  71. }