Each student has a user (one to one), languages and hobbies (both many to many).
A match is composed by two students (self relationship)
I wan to fill a multidimensional array with the matchId, all the info about the first student and all about the second. I'm populating it array this way:
$matches = Match::getMatches($semester->id);
foreach ($matches as $m)
{
$profiles[] = array(
'matchId' => $m->matchId,
'local' => Student::with('user', 'language', 'hobby')->where('user_id', $m->localUserId)->first(),
'incoming'=> Student::with('user', 'language', 'hobby')->where('user_id', $m->incomingUserId)->first());
}
Now I want to access that data in a blade template but cannot succeed.
{{ $profiles['local'] }}
works, but when adding something like
{{ $profiles['local']['email'] }}
I get nasty errors.
Any hints?