I'm getting a problem while I want to loop through an array and display it with Laravel blade engine
My controllers code is like this
$table = DB::table('tables')->select('id')->where('name', strtolower($name))->first();
$columns = Column::where('table_id', $table->id)->get();
foreach ($columns as $col) {
$data[] = $col->col_name;
};
$content = DB::table($name)->select(...$data)->get();
return view('back.group.view-table', compact('content', 'columns', 'data'));
And my blade view code is like this
<table class="table table-striped">
<thead>
<tr>
@foreach($columns as $column)
<th>{{ $column->dis_name }}</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach ($content as $value)
<tr>
@for ($i = 0; $i < count($columns); $i++)
<td>{{ $value->key = $data[$i] }}</td>
@endfor
</tr>
@endforeach
</tbody>
</table>

