Skip to content

Commit 837f2a9

Browse files
authored
Merge pull request barryvdh#962 from mikebronner/patch-1
Protect against possible null values in `$models` array.
2 parents b61f401 + fe7fb05 commit 837f2a9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/DataCollector/ModelsCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __construct(Dispatcher $events)
2424

2525
$events->listen('eloquent.*', function ($event, $models) {
2626
if (Str::contains($event, 'eloquent.retrieved')) {
27-
foreach ($models as $model) {
27+
foreach (array_filter($models) as $model) {
2828
$class = get_class($model);
2929
$this->models[$class] = ($this->models[$class] ?? 0) + 1;
3030
}

0 commit comments

Comments
 (0)