UserUpdate.php 2.6 KB

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