Support the ongoing development of Laravel.io →
posted 11 years ago
Eloquent

Has anyone thought of extending this method?

For example I have a couple of models with the following relationships:

Club (has many Team) Teams (has many Players, belongs to a coach (Member)) Player (belongs to a Member) Member

If I want to retrieve a club with all teams including the team players and coach I would have to do the following

$builder->with(array('teams.coach', 'teams.players'));

A nicer way would be to retrieve them by using:

$builder->with(array('teams.coach|players')); // using | as a second delimiter

Right now this is a small example but it gets really nasty with very deep relationships. Is there any interest for something like this or is someone already extending this?

Cheers,

Ash

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

ashrbel ashrbel Joined 2 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.