PrescriptionValidator.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace App\Repositories\Validators\TCM;
  3. use \Prettus\Validator\Contracts\ValidatorInterface;
  4. use \Prettus\Validator\LaravelValidator;
  5. /**
  6. * Class PrescriptionValidator.
  7. *
  8. * @package namespace App\Repositories\Validators\TCM;
  9. */
  10. class PrescriptionValidator extends LaravelValidator
  11. {
  12. /**
  13. * Validation Rules
  14. *
  15. * @var array
  16. */
  17. protected $rules = [
  18. ValidatorInterface::RULE_CREATE => [
  19. "medical_record_id" => "required|integer",
  20. "drug_type" => "required",
  21. "eat_type" => "required",
  22. "number" => "required",
  23. "advice_type" => "required",
  24. "advice_frequency" => "required",
  25. "one_consumption" => "required",
  26. "use_unit" => "required",
  27. "advice" => "sometimes",
  28. "drugs" => "required",
  29. "patient_id" => "required|integer",
  30. "status" => "required",
  31. ],
  32. ValidatorInterface::RULE_UPDATE => [
  33. "medical_record_id" => "required|integer",
  34. "drug_type" => "required",
  35. "eat_type" => "required",
  36. "number" => "required",
  37. "advice_type" => "required",
  38. "advice_frequency" => "required",
  39. "one_consumption" => "required",
  40. "use_unit" => "required",
  41. "advice" => "sometimes",
  42. "drugs" => "required",
  43. "patient_id" => "required|integer",
  44. "status" => "required",
  45. ],
  46. ];
  47. }