2015-10-15 67 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()) !!}