Skip to content

Commit 7427b91

Browse files
committed
Merge pull request formers#246 from spaceemotion/develop
Added support for MessageBags to Former:.withErrors()
2 parents 2cf47d1 + 3d34658 commit 7427b91

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Former/Former.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use Closure;
55
use Illuminate\Container\Container;
66
use Illuminate\Validation\Validator;
7+
use Illuminate\Support\MessageBag;
78

89
/**
910
* Helps the user interact with the various Former components
@@ -260,6 +261,9 @@ public function withErrors($validator = null)
260261
// If we're given a raw Validator, go fetch the errors in it
261262
if ($validator instanceof Validator) {
262263
$this->errors = $validator->getMessageBag();
264+
265+
} else if ($validator instanceof MessagBag) {
266+
$this->errors = $validator;
263267
}
264268

265269
return $this->errors;

0 commit comments

Comments
 (0)