Skip to content
New issue

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

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

Already on GitHub? # to your account

[Bug]: N+1 Query when checking model is banned #8

Closed
rahmanramsi opened this issue Jun 9, 2023 · 1 comment
Closed

[Bug]: N+1 Query when checking model is banned #8

rahmanramsi opened this issue Jun 9, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@rahmanramsi
Copy link

What happened?

Checking model is banned while looping on list make N+1 Query even the relationship is eager loaded.

How to reproduce the bug

$users = User::with(['bans'])->get();
foreach ($users as $user) {
    $user->isBanned();
}

Package Version

1.2.0

PHP Version

8.2.6

Laravel Version

10.13.2

Which operating systems does with happen with?

macOS

Notes

No response

@rahmanramsi rahmanramsi added the bug Something isn't working label Jun 9, 2023
mchev added a commit that referenced this issue Jun 10, 2023
@mchev
Copy link
Owner

mchev commented Jun 10, 2023

Thanks @rahmanramsi
Fixed in v1.2.1

@mchev mchev closed this as completed Jun 10, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants