UserUpdate.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace App\Http\Requests\Admin;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class UserUpdate extends FormRequest
  5. {
  6. CONST RULES = [
  7. 'email' => 'required|email',
  8. 'password' => 'nullable',
  9. 'transfer_enable' => 'numeric',
  10. 'expired_at' => 'nullable|integer',
  11. 'banned' => 'required|in:0,1',
  12. 'plan_id' => 'nullable|integer',
  13. 'commission_rate' => 'nullable|integer|min:0|max:100',
  14. 'discount' => 'nullable|integer|min:0|max:100',
  15. 'is_admin' => 'required|in:0,1',
  16. 'u' => 'integer',
  17. 'd' => 'integer',
  18. 'balance' => 'integer',
  19. 'commission_balance' => 'integer'
  20. ];
  21. /**
  22. * Get the validation rules that apply to the request.
  23. *
  24. * @return array
  25. */
  26. public function rules()
  27. {
  28. return self::RULES;
  29. }
  30. public function messages()
  31. {
  32. return [
  33. 'email.required' => '邮箱不能为空',
  34. 'email.email' => '邮箱格式不正确',
  35. 'transfer_enable.numeric' => '流量格式不正确',
  36. 'expired_at.integer' => '到期时间格式不正确',
  37. 'banned.required' => '是否封禁不能为空',
  38. 'banned.in' => '是否封禁格式不正确',
  39. 'is_admin.required' => '是否管理员不能为空',
  40. 'is_admin.in' => '是否管理员格式不正确',
  41. 'plan_id.integer' => '订阅计划格式不正确',
  42. 'commission_rate.integer' => '推荐返利比例格式不正确',
  43. 'commission_rate.nullable' => '推荐返利比例格式不正确',
  44. 'commission_rate.min' => '推荐返利比例最小为0',
  45. 'commission_rate.max' => '推荐返利比例最大为100',
  46. 'discount.integer' => '专属折扣比例格式不正确',
  47. 'discount.nullable' => '专属折扣比例格式不正确',
  48. 'discount.min' => '专属折扣比例最小为0',
  49. 'discount.max' => '专属折扣比例最大为100',
  50. 'u.integer' => '上行流量格式不正确',
  51. 'd.integer' => '下行流量格式不正确',
  52. 'balance.integer' => '余额格式不正确',
  53. 'commission_balance.integer' => '佣金格式不正确'
  54. ];
  55. }
  56. }