@@ 86-95 (lines=10) @@ | ||
83 | * |
|
84 | * @return self |
|
85 | */ |
|
86 | public function array(array $array, array $rules, array $messages = [], $group = null) |
|
87 | { |
|
88 | foreach ($rules as $key => $options) { |
|
89 | $value = $array[$key] ?? null; |
|
90 | ||
91 | $this->value($value, $key, $options, $messages, $group); |
|
92 | } |
|
93 | ||
94 | return $this; |
|
95 | } |
|
96 | ||
97 | /** |
|
98 | * Validates an objects properties with the given rules. |
|
@@ 128-137 (lines=10) @@ | ||
125 | * |
|
126 | * @return self |
|
127 | */ |
|
128 | public function request(Request $request, array $rules, array $messages = [], $group = null) |
|
129 | { |
|
130 | foreach ($rules as $param => $options) { |
|
131 | $value = $this->getRequestParam($request, $param); |
|
132 | ||
133 | $this->value($value, $param, $options, $messages, $group); |
|
134 | } |
|
135 | ||
136 | return $this; |
|
137 | } |
|
138 | ||
139 | /** |
|
140 | * Validates request parameters, an array or an objects properties. |