I'm trying to take our some info from mysql with laravel. My controller:
$match->message = DB::table('log')->where('match_id', '=', $match->match_id)->get(['message']);
$match->authid = DB::table('log')->where('match_id', '=', $match->match_id)->get(['authid']);
My blade:
@foreach ($match->authid as $username)
@foreach ($match->message as $text)
{{ $username->authid }} {{ $text->message }}<br />
@endforeach
@endforeach
But getting 4 results incorrectly. Getting:
- AUTHD_ID1 log1
- AUTHD_ID1 log2
- AUTHD_ID2 log1
- AUTHD_ID2 log2
Should be:
- AUTHD_ID1 log1
- AUTHD_ID2 log2
Whats wrong?