ProcurementAmountRequest.php 996 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace App\Http\Requests\Procurement;
  3. use App\Traits\RequestApiFormValidation;
  4. use Illuminate\Foundation\Http\FormRequest;
  5. class ProcurementAmountRequest extends FormRequest
  6. {
  7. use RequestApiFormValidation;
  8. /**
  9. * Determine if the user is authorized to make this request.
  10. *
  11. * @return bool
  12. */
  13. public function authorize()
  14. {
  15. return true;
  16. }
  17. /**
  18. * Get the validation rules that apply to the request.
  19. *
  20. * @return array
  21. */
  22. public function rules()
  23. {
  24. return [
  25. 'quantity'=>'required|numeric|min:0|not_in:0',
  26. 'amount'=>'required|numeric|min:0|not_in:0',
  27. ];
  28. }
  29. public function messages()
  30. {
  31. return [
  32. 'quantity.required' => '采购数量不可为空',
  33. 'quantity.not_in' => '采购数量不可为0',
  34. 'amount.required' => '销售数量不可为空',
  35. 'amount.not_in' => '销售数量不可为0',
  36. ];
  37. }
  38. }