Skip to content

Conversation

@mahmoudmohamedramadan
Copy link
Contributor

According to this PR I have added a withoutEagerLoad to prevent the given relationships from being eagerly loaded.

$user = \App\Models\User::with(['post', 'attachment'])->first();

// This line will return the first user with the post relationship
return $user->withoutEagerLoad(['attachment'])->first();

@taylorotwell taylorotwell merged commit c24bf57 into laravel:9.x Jun 3, 2022
@GrahamCampbell GrahamCampbell changed the title Adds withoutEagerLoad function [9.x] Adds withoutEagerLoad function Jun 3, 2022
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.

3 participants