CouponRequest.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. 'site' => 'required',
  40. 'give_count' => '',
  41. 'order_type' => '',
  42. 'status' => 'required',
  43. ];
  44. }
  45. public function attributes()
  46. {
  47. return [
  48. //
  49. 'title' => '标题',
  50. 'icon' => '图片',
  51. 'with_amount' => '满多少金额',
  52. 'used_amount' => '可减少金额',
  53. 'type' => '优惠券类型',
  54. 'is_quota' => '是否限制发券数量',
  55. 'quota' => '可发券数量',
  56. 'discount ' => '折扣',
  57. 'grant_start_at' => '发放开始时间',
  58. 'grant_end_at' => '发放结束时间',
  59. 'valid_type' => '时效类型',
  60. 'valid_start_time' => '生效时间',
  61. 'valid_end_time' => '失效时间',
  62. 'valid_days' => '得到后有效天数',
  63. 'order_type' => '可用订单类型',
  64. 'area_id' => '区域',
  65. 'site' => '类型',
  66. 'give_count' => '赠送数量',
  67. 'status' => '是否启用',
  68. ];
  69. }
  70. }