Skip to content

[5.4] Prevent applying global scopes on the factory while setting connection - #19258

Merged
taylorotwell merged 1 commit into
laravel:5.4from
themsaid:factoryGlobalScopes
May 18, 2017
Merged

[5.4] Prevent applying global scopes on the factory while setting connection#19258
taylorotwell merged 1 commit into
laravel:5.4from
themsaid:factoryGlobalScopes

Conversation

@themsaid

Copy link
Copy Markdown
Member

With the changes in #18846, we use:

$model->setConnection($model->query()->getConnection()->getName());

Using $model->query() applies the global scopes to the query which caused the problem reported in #19254

@JosephSilber

Copy link
Copy Markdown
Contributor

Isn't it a bug that they weren't applying global scopes before?

@taylorotwell
taylorotwell merged commit 0ff3938 into laravel:5.4 May 18, 2017
@taylorotwell

Copy link
Copy Markdown
Member

@JosephSilber it doesn't seem like we would want to run global scopes just to get the connection name?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants