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

N+1 #5

Open
yormy opened this issue Nov 8, 2020 · 0 comments
Open

N+1 #5

yormy opened this issue Nov 8, 2020 · 0 comments

Comments

@yormy
Copy link

yormy commented Nov 8, 2020

When calling isSubscribed on a user->with('NotificationSubscriptions)

The following returns an n+1 problem, as you are requerying instead of using the loaded relations

return $this->notificationSubscriptions()->where('type', $type)->where('channel', $channel)->model($model)->first();
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

No branches or pull requests

1 participant