Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use newQuery() instead of query() in DatabaseEngine #713

Merged
merged 1 commit into from
Mar 6, 2023
Merged

Use newQuery() instead of query() in DatabaseEngine #713

merged 1 commit into from
Mar 6, 2023

Conversation

jbelien
Copy link
Contributor

@jbelien jbelien commented Mar 6, 2023

The issue with $builder->model->query() is the fact that it creates a new query from a "new" static model; $builder->model->newQuery() will create a query from the current object (see Illuminate\Database\Eloquent\Model abstract class).

If you set the schema (or table name) of your model dynamically, $builder->model->query() will not work.
See #712 for more details.

Close #712

@jbelien jbelien mentioned this pull request Mar 6, 2023
Copy link
Member

@driesvints driesvints left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks okay to me.

@taylorotwell taylorotwell merged commit 0adb7ed into laravel:10.x Mar 6, 2023
@jbelien jbelien deleted the patch-1 branch March 6, 2023 14:46
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.

Issue with dynamic schema
3 participants