Validator.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. }