1
我使用Laravel 5.5,我想從我的視圖頁面查看我的數據庫中的數據(home.blade.php)如何從laravel5.5獲取數據?
<table>
<tbody>
@foreach($home as $key => $data)
<tr>
<th>{{$data->created_at}}</th>
<th>{{$data->category}}</th>
<th>{{$data->reportitle}}</th>
<th>{{$data->reportdetails}}</th>
<th>{{$data->seenstat}}</th>
<th>{{$data->actionstat}}</th>
<th>{{$data->donestat}}</th>
</tr>
@endforeach
</tbody>
</table>
在我home.blade.php我有一個空表,我想表明從數據庫五年計劃數據:
Route::get('home', function() {
$fyp = DB::table('reports')->get();
return view('home', ['fyp' => $fyp]);
});
你通過'$ fyp'變量不是'$ home'。通過'$ fyp'變量循環 –