File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -16,13 +16,13 @@ class ModelException extends ValidationException
1616 protected $ model ;
1717
1818 /**
19- * __construct recevies the troublesome model
19+ * __construct receives the troublesome model
2020 */
2121 public function __construct (Model $ model )
2222 {
23+ parent ::__construct ($ model ->errors ());
24+
2325 $ this ->model = $ model ;
24- $ this ->errors = $ model ->errors ();
25- $ this ->evalErrors ();
2626 }
2727
2828 /**
Original file line number Diff line number Diff line change 33use Validator as ValidatorFacade ;
44use Illuminate \Validation \ValidationException as ValidationExceptionBase ;
55use Illuminate \Validation \Validator ;
6+ use Illuminate \Support \MessageBag ;
67use InvalidArgumentException ;
78
89/**
@@ -55,6 +56,10 @@ protected function resolveToValidator($validation)
5556 $ validator = ValidatorFacade::make ([], []);
5657 $ validator ->errors ()->merge ($ validation );
5758 }
59+ elseif ($ validation instanceof MessageBag) {
60+ $ validator = ValidatorFacade::make ([], []);
61+ $ validator ->errors ()->merge ($ validation ->messages ());
62+ }
5863
5964 if (!$ validator instanceof Validator) {
6065 throw new InvalidArgumentException ('ValidationException constructor requires instance of Validator or array ' );
You can’t perform that action at this time.
0 commit comments