我是Laravel 5的新手,我有一个显示分页的问题。我查看了文档,但无法让它工作。
UserController中:
public function getIndex()
{
$users = User::where('active', '=','verified')->simplePaginate(10);
return View::make('User.index')->with('users',$users);
}
index.blade.php:
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>id</th>
<th>username</th>
<th>email</th>
<th>role</th>
<th>created</th>
<th class="actions">Actions</th>
</tr>
</thead>
<tbody>
@foreach($users as $user)
<tr>
<td>{{ $user->id }}</td>
<td>{{ $user->username }}</td>
<td>{{ $user->email }}</td>
<td>{{ $user->role }}</td>
<td>{{ $user->created_at }}</td>
<td class="actions">
blabla
</td>
</tr>
@endforeach
</tbody>
</table>
{!! $users->render() !!}
答案 0 :(得分:0)
由于某种原因,它正在打印额外的/
修正:
{!! str_replace('users/','users',$users->render()) !!}