Skip to content
This repository was archived by the owner on Apr 13, 2022. It is now read-only.

Commit 736464f

Browse files
Call the validate method first
1 parent 58445d8 commit 736464f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/ValidatingMiddleware.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,17 @@ public function handle($command, Closure $next)
7272
*/
7373
protected function validate($command)
7474
{
75+
if (method_exists($command, 'validate')) {
76+
$command->validate();
77+
}
78+
7579
$messages = property_exists($command, 'validationMessages') ? $command->validationMessages : [];
7680

7781
$validator = $this->factory->make($this->getData($command), $command->rules, $messages);
7882

7983
if ($validator->fails()) {
8084
throw new ValidationException($validator->getMessageBag());
8185
}
82-
83-
if (method_exists($command, 'validate')) {
84-
$command->validate();
85-
}
8686
}
8787

8888
/**

0 commit comments

Comments
 (0)