PatientValidator.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace App\Repositories\Validators\TCM;
  3. use \Prettus\Validator\Contracts\ValidatorInterface;
  4. use \Prettus\Validator\LaravelValidator;
  5. /**
  6. * Class PatientValidator.
  7. *
  8. * @package namespace App\Repositories\Validators\TCM;
  9. */
  10. class PatientValidator extends LaravelValidator
  11. {
  12. /**
  13. * Validation Rules
  14. *
  15. * @var array
  16. */
  17. protected $rules = [
  18. ValidatorInterface::RULE_CREATE => [
  19. 'name' => 'required',
  20. 'sex' => 'required|integer',
  21. 'avatar' => 'sometimes|integer',
  22. 'birth_date' => 'required|date',
  23. 'source' => 'sometimes|integer',
  24. 'mobile' => 'sometimes',
  25. 'occupation' => 'sometimes',
  26. 'allergy' => 'sometimes|array',
  27. 'past_medical' => 'sometimes|array',
  28. 'hospital' => 'sometimes',
  29. 'status' => 'required|integer',
  30. ],
  31. ValidatorInterface::RULE_UPDATE => [
  32. 'name' => 'required',
  33. 'sex' => 'required|integer',
  34. 'avatar' => 'sometimes|integer',
  35. 'birth_date' => 'required|date',
  36. 'source' => 'sometimes|integer',
  37. 'mobile' => 'sometimes',
  38. 'occupation' => 'sometimes',
  39. 'allergy' => 'sometimes|array',
  40. 'past_medical' => 'sometimes|array',
  41. 'hospital' => 'sometimes',
  42. 'status' => 'required|integer',
  43. ],
  44. ];
  45. }