andyandy
4 weeks ago

Printing table without knowing column names?

Posted 4 weeks ago by andyandy

I want to do this.

//controller
$randomTable = Articles::orderBy('id', 'desc')->get();

//blade
@forelse($randomTable as $item)

<tr><td>{{$item->id}}</td><td>{{$item->title}}</td><td>{{$item->text}}</td></tr>

@empty
no results
@endforelse

But I want it to auto-detect all columns in table. And print out all available columns.

Please sign in or create an account to participate in this conversation.