我刚接触过Laravel 5,我有一个显示分页的问题。我查看了文档,只是无法让它起作用。
用户控制器:
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() !!}发布于 2015-10-15 14:25:39
出于某种原因,它打印了一个额外的/。
修正:
{!! str_replace('users/','users',$users->render()) !!}https://stackoverflow.com/questions/33138519
复制相似问题