Skip to content

[9.x] Adds withoutEagerLoad function#42641

Merged
taylorotwell merged 2 commits into
laravel:9.xfrom
mahmoudmohamedramadan:9.x
Jun 3, 2022
Merged

[9.x] Adds withoutEagerLoad function#42641
taylorotwell merged 2 commits into
laravel:9.xfrom
mahmoudmohamedramadan:9.x

Conversation

@mahmoudmohamedramadan

Copy link
Copy Markdown
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();

Comment thread src/Illuminate/Database/Eloquent/Builder.php Outdated
@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