Validator.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace Illuminate\Contracts\Validation;
  3. use Illuminate\Contracts\Support\MessageProvider;
  4. interface Validator extends MessageProvider
  5. {
  6. /**
  7. * Run the validator's rules against its data.
  8. *
  9. * @return array
  10. */
  11. public function validate();
  12. /**
  13. * Get the attributes and values that were validated.
  14. *
  15. * @return array
  16. */
  17. public function validated();
  18. /**
  19. * Determine if the data fails the validation rules.
  20. *
  21. * @return bool
  22. */
  23. public function fails();
  24. /**
  25. * Get the failed validation rules.
  26. *
  27. * @return array
  28. */
  29. public function failed();
  30. /**
  31. * Add conditions to a given field based on a Closure.
  32. *
  33. * @param string|array $attribute
  34. * @param string|array $rules
  35. * @param callable $callback
  36. * @return $this
  37. */
  38. public function sometimes($attribute, $rules, callable $callback);
  39. /**
  40. * Add an after validation callback.
  41. *
  42. * @param callable|string $callback
  43. * @return $this
  44. */
  45. public function after($callback);
  46. /**
  47. * Get all of the validation error messages.
  48. *
  49. * @return \Illuminate\Support\MessageBag
  50. */
  51. public function errors();
  52. }