CouponRequest.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace App\Http\Requests;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class CouponRequest extends FormRequest
  5. {
  6. /**
  7. * Determine if the user is authorized to make this request.
  8. *
  9. * @return bool
  10. */
  11. public function authorize()
  12. {
  13. return true;
  14. }
  15. /**
  16. * Get the validation rules that apply to the request.
  17. *
  18. * @return array
  19. */
  20. public function rules()
  21. {
  22. return [
  23. //
  24. 'title' => 'required',
  25. 'icon' => '',
  26. 'with_amount' => '',
  27. 'used_amount' => '',
  28. 'type' => 'required',
  29. 'is_quota' => 'required',
  30. 'quota' => 'required',
  31. 'discount'=> 'sometimes',
  32. 'grant_start_at' => 'required',
  33. 'grant_end_at' => 'required',
  34. 'valid_type' => 'required',
  35. 'valid_start_time' => 'required',
  36. 'valid_end_time' => 'required',
  37. 'valid_days' => 'required',
  38. 'area_id' => 'required',
  39. 'order_type' => '',
  40. 'status' => 'required',
  41. ];
  42. }
  43. public function attributes()
  44. {
  45. return [
  46. //
  47. 'title' => '标题',
  48. 'icon' => '图片',
  49. 'with_amount' => '满多少金额',
  50. 'used_amount' => '可减少金额',
  51. 'type' => '优惠券类型',
  52. 'is_quota' => '是否限制发券数量',
  53. 'quota' => '可发券数量',
  54. 'discount '=> '折扣',
  55. 'grant_start_at' => '发放开始时间',
  56. 'grant_end_at' => '发放结束时间',
  57. 'valid_type' => '时效类型',
  58. 'valid_start_time' => '生效时间',
  59. 'valid_end_time' => '失效时间',
  60. 'valid_days' => '得到后有效天数',
  61. 'order_type' => '可用订单类型',
  62. 'area_id' => '区域',
  63. 'status' => '是否启用',
  64. ];
  65. }
  66. }