Skip to content
Advertisement

Laravel Load Relation With Condition On Model

I’m attempting to eager load a user’s notifications with a relation that depends on a value of notification model:

The issue is the $query within the closures are querying on the notifiable relation rather than the notification model itself… I’m obviously missing something very trivial. Any suggestions?

Advertisement

Answer

You could make use of Lazy Eager Loading

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement