ProcurementRequest.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace App\Http\Requests\Procurement;
  3. use App\Traits\RequestApiFormValidation;
  4. use Illuminate\Foundation\Http\FormRequest;
  5. class ProcurementRequest 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. 'owner_id'=>'required',
  26. 'owner_material_id'=>'required',
  27. 'quantity'=>'required',
  28. 'amount'=>'required',
  29. ];
  30. }
  31. public function messages()
  32. {
  33. return [
  34. 'owner_id.required' => '项目必选',
  35. 'owner_material_id.required' => '项目耗材编码必选',
  36. 'quantity.required' => '采购数量不可为空',
  37. 'amount.required' => '销售数量不可为空',
  38. ];
  39. }
  40. }