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

[11.x] Pass collection of models to whereMorphedTo / whereNotMorphedTo #54324

Merged

Conversation

gdebrauwer
Copy link
Contributor

@gdebrauwer gdebrauwer commented Jan 23, 2025

The whereBelongsTo method supports providing a collection of models. This PR adds that behavior to the whereMorphedTo (and whereNotMorphedTo) method

Comment::whereMorphedTo('commentable', $posts)->get();

Comment::whereNotMorphedTo('commentable', $posts)->get();

It also supports providing a collection with different kinds of models:

Comment::whereMorphedTo('commentable', [$post, $video])->get();

Comment::whereNotMorphedTo('commentable', [$post, $video])->get();

@gdebrauwer gdebrauwer marked this pull request as draft January 23, 2025 16:41
@gdebrauwer gdebrauwer marked this pull request as ready for review January 24, 2025 15:57
@taylorotwell taylorotwell merged commit f4043fe into laravel:11.x Jan 24, 2025
38 checks passed
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