0
我想使用yajara-laravel-databaseLaravel 5.4數據表插件
這是我的控制器
public function index(Request $request){
$posts = Datatables::eloquent(Posts::query())->make(true);
return View::make('dashboard.approval', compact('posts'));
}
這是我的看法
<table class="ui celled table">
<thead>
<tr><th>id</th>
<th>Title</th>
<th>Description</th>
</tr></thead>
<tbody>
@foreach($posts as $post)
<tr>
<td>lsdjflajsdlk</td>
<td>Hello</td>
<td>Hello</td>
</tr>
@endforeach
</tbody>
</table>
@endsection
這是我的腳本標籤
<script>
$(document).ready(function(){
$('.table').DataTable({
});
});
</script>
我我正在獲取數據表結構。但目前我只獲得3行,但我有7行數據,我通過在HTML視圖中放置{{$ posts}}進行了驗證。
的{{$帖子}}
HTTP/1.0 200 OK Cache-Control: no-cache, private Content-Type: application/json {"draw":0,"recordsTotal":7,"recordsFiltered":7,"data":[{"id":"1",".............],"queries":[{"query":"select count(*) as aggregate from (select '1' as `row_count` from `posts`) count_row_table","bindings":[],"time":70.87},{"query":"select * from `posts`","bindings":[],"time":2.22}],"input":[]}
我試圖把{{$後> ID}} HTML視圖,並得到這個錯誤
Undefined property: Symfony\Component\HttpFoundation\ResponseHeaderBag::$id
試過代碼{{$ }
htmlspecialchars() expects parameter 1 to be string, array given
什麼是填充數據的過程。該wiki網址無效