MenuValidator.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace App\Repositories\Validators\Base;
  3. use \Prettus\Validator\Contracts\ValidatorInterface;
  4. use \Prettus\Validator\LaravelValidator;
  5. /**
  6. * Class MenuValidator.
  7. *
  8. * @package namespace App\Repositories\Validators\Base;
  9. */
  10. class MenuValidator extends LaravelValidator
  11. {
  12. /**
  13. * Validation Rules
  14. *
  15. * @var array
  16. */
  17. protected $rules = [
  18. ValidatorInterface::RULE_CREATE => [
  19. 'parent_id' => 'required|integer',
  20. 'name' => 'required',
  21. 'zh_title' => 'required',
  22. 'en_title' => 'required',
  23. 'path' => 'required',
  24. 'component' => 'required',
  25. 'redirect' => 'nullable',
  26. 'meta' => 'required',
  27. 'sort' => 'required|integer',
  28. 'status' => 'required|integer',
  29. ],
  30. ValidatorInterface::RULE_UPDATE => [
  31. 'parent_id' => 'required|integer',
  32. 'name' => 'required',
  33. 'zh_title' => 'required',
  34. 'en_title' => 'required',
  35. 'path' => 'required',
  36. 'component' => 'required',
  37. 'redirect' => 'nullable',
  38. 'meta' => 'required',
  39. 'sort' => 'required|integer',
  40. 'status' => 'required|integer',
  41. ],
  42. ];
  43. }