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