Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Wakanda's avatar
Level 10

without global scope of a relation per specific query

Hi Devs, how can I get courses without the global scope only on this specific query unlike implementing on the model level?

$user = $user->user()->with('instructor', 'instructor.order', 'courses', 'courses.review', 'courses.category')->first();
0 likes
4 replies
Wakanda's avatar
Level 10

@snapey I want withoutGlobalScope to only to be applied to courses which is a relation of user in the above query

Snapey's avatar
Snapey
Best Answer
Level 122

create a different relation name and try removing the global scope there

1 like

Please or to participate in this conversation.