2015-10-15 84 views
0

我是Laravel 5的新手,我遇到显示分页的问题。我查看了文档,但无法使其正常工作。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

会发生什么?我看起来很好。你确定你有超过10件物品吗?如果只有1个页面,则不显示分页 – andrewtweber

+0

我确实没有10个项目,但不应该显示第1页或1页 – user3813360

+0

如果需要,您必须覆盖默认页面功能。默认情况下,如果只有1页,则不显示任何分页 – andrewtweber

回答

0

出于某种原因,它打印的附加/

修复:

{!! str_replace('users/','users',$users->render()) !!}