We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 159255c + 8596d0a commit 060331aCopy full SHA for 060331a
src/AggregateRoots/AggregateRoot.php
@@ -4,6 +4,7 @@
4
5
use Carbon\CarbonImmutable;
6
use Illuminate\Database\QueryException;
7
+use Illuminate\Database\UniqueConstraintViolationException;
8
use Illuminate\Support\Collection;
9
use Illuminate\Support\Facades\DB;
10
use Illuminate\Support\LazyCollection;
@@ -143,7 +144,7 @@ protected function persistWithoutApplyingToEventHandlers(): LazyCollection
143
144
$this->uuid(),
145
);
146
} catch (QueryException $exception) {
- if (! str_contains($exception->getMessage(), 'Duplicate')) {
147
+ if (! ($exception instanceof UniqueConstraintViolationException || str_contains($exception->getMessage(), 'Duplicate'))) {
148
throw $exception;
149
}
150
0 commit comments