RoleValidator.php 884 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace App\Repositories\Validators\Base;
  3. use \Prettus\Validator\Contracts\ValidatorInterface;
  4. use \Prettus\Validator\LaravelValidator;
  5. /**
  6. * Class RoleValidator.
  7. *
  8. * @package namespace App\Repositories\Validators\Base;
  9. */
  10. class RoleValidator extends LaravelValidator
  11. {
  12. /**
  13. * Validation Rules
  14. *
  15. * @var array
  16. */
  17. protected $rules = [
  18. ValidatorInterface::RULE_CREATE => [
  19. 'name' => 'required',
  20. 'menus' => 'sometimes|array',
  21. 'parent_menus' => 'sometimes|array',
  22. 'sort' => 'required',
  23. 'status' => 'required'
  24. ],
  25. ValidatorInterface::RULE_UPDATE => [
  26. 'name' => 'required',
  27. 'menus' => 'sometimes|array',
  28. 'parent_menus' => 'sometimes|array',
  29. 'sort' => 'required',
  30. 'status' => 'required'
  31. ],
  32. ];
  33. }