You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
950 B

5 years ago
5 years ago
5 years ago
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Request\v3;
  4. use App\Request\BaseFormRequest;
  5. class GoodsEditorRequest extends BaseFormRequest
  6. {
  7. /**
  8. * Get the validation rules that apply to the request.
  9. */
  10. public function rules(): array
  11. {
  12. return [
  13. 'id' => 'required',
  14. 'market_id' => 'required|nonempty|integer',
  15. 'store_id' => 'required|nonempty|integer',
  16. 'name' => 'required|nonempty',
  17. 'category_id' => 'required|nonempty|integer',
  18. 'price' => 'required|nonempty',
  19. 'is_infinite' => 'required',
  20. 'inventory' => 'required',
  21. 'on_sale' => 'required',
  22. ];
  23. }
  24. /**
  25. * @return array
  26. */
  27. public function messages(): array
  28. {
  29. return [
  30. '*.*' => ':attribute无效',
  31. ];
  32. }
  33. public function attributes(): array
  34. {
  35. return parent::attributes();
  36. }
  37. }