Here you can see I can store two different team names in my table
.
I want to view them in my index.blade.php so I did this in my index.blade.php but it`s showing team 1 name everytime.
<table id="example1" class="table table-bordered table-striped table-sm">
<thead>
<tr>
<th>SL</th>
<th>Match Name</th>
<th>Match Slug</th>
<th>Team 1 Name</th>
<th>Team 2 Name</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach ($data as $key => $row)
<tr>
<td>{{ $key + 1 }}</td>
<td>{{ $row->match_name }}</td>
<td>{{ $row->match_slug }}</td>
<td>{{ $row->team->team_name }}</td>
<td>{{ $row->team->team_name }}</td>
</tr>
@endforeach
</tbody>
</table>
This is my index method
public function index()
{
$data=Matchh::all();
$team=Team::all();
return view('admin.manage.matchh.index', compact('data','team'));
}

