Skip to content

Fixed Enum usage in whereHasMorph condition when morph attribute casting#53839

Merged
taylorotwell merged 4 commits into
laravel:11.xfrom
Outsidaz:11.x
Dec 11, 2024
Merged

Fixed Enum usage in whereHasMorph condition when morph attribute casting#53839
taylorotwell merged 4 commits into
laravel:11.xfrom
Outsidaz:11.x

Conversation

@Outsidaz

Copy link
Copy Markdown
Contributor

When using Laravel’s whereHasMorph condition with a model attribute that is a morph type and cast as an Enum, the following error occurs:

->whereHasMorph('relationName', '*', function ($query) { $query->where('status', SomeTypeEnum::Active); });

Cannot access offset of type SomeTypeEnum on array

This issue arises due to improper handling of Enum values in the query builder when the morph attribute is processed.

@taylorotwell taylorotwell merged commit 0365480 into laravel:11.x Dec 11, 2024
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.

2 participants