Open sebj54 opened 12 hours ago
Hey there, thanks for reporting this issue.
We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here?
Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.
laravel new bug-report --github="--public"
Do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue.
Thanks!
Laravel Version
11.33.0
PHP Version
8.3.13
Database Driver & Version
No response
Description
Since version 11.33.0 and more precisely this commit: https://github.com/laravel/framework/commit/8528d04598f99f7cfa0f0aab56c170f8fd583024, the constraints applied on
MorphTo
relations have changed.For the example, let's say I have the example relation from the docs: https://laravel.com/docs/11.x/eloquent-relationships#one-to-one-polymorphic-model-structure. So I have an
Image
model with animageable
relation (MorphTo
), pointing to aPost
.Before that commit, the foreign key constraint was correctly added to the relation query: it added a where like this:
Now with the latest version, the only where is:
This bug breaks some packages like https://github.com/kirschbaum-development/eloquent-power-joins.
Steps To Reproduce
MorphTo
relation (for exampleImage::imageable
)$relation = (new Image)->imageable()
wheres
of the query11.32.x
to11.33.x
Feel free to ask if you need a proper reproduction to work on this but I think you have some test projects already covering this feature.
Thanks for your help!