Skip to content

Commit 0ff3938

Browse files
themsaidtaylorotwell
authored andcommitted
prevent applying global scopes on the factory while setting the connection (#19258)
1 parent 4eb16f0 commit 0ff3938

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Illuminate/Database/Eloquent/FactoryBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public function create(array $attributes = [])
143143
protected function store($results)
144144
{
145145
$results->each(function ($model) {
146-
$model->setConnection($model->query()->getConnection()->getName());
146+
$model->setConnection($model->newQueryWithoutScopes()->getConnection()->getName());
147147

148148
$model->save();
149149
});

0 commit comments

Comments
 (0)