Custom queries in Laravel’s Eloquent relationships
Laravel’s relationship classes and methods cover like 90% of my use cases. But sometimes, there’s some weird distant relationship between a few models that doesn’t quite fit a HasMany or BelongsTo. For instance, I’ve been working with an app that has a few models, some of which are distantly related. The relationship looks like this: … Continued