Hey Valorin, I think my relationships are set up properly. Many to many for events and friends. I'm just struggling with this:
I have a query that is bringing back multiple events with only the event data. I want to also have in that return the friends associated with each event it returns.
So events would return something like this:
Name
Address
Friends [ bob, sally, tom ]
see what im saying? I just don't get how to get the friends model into that return set.
This is my event model relationships
public function user()
{
return $this->belongsTo('User');
}
public function friends(){
return $this->belongsToMany('Friend')->withTimestamps();
}
This is my friends model relationships
public function user()
{
return $this->belongsTo('User');
}
public function cliqueEvents(){
return $this->belongsToMany('CliqueEvent')->withTimestamps();
}
User model relationships
public function friends()
{
return $this->hasMany('Friend');
}
public function cliqueEvents()
{
return $this->hasMany('CliqueEvent');
}