Commit 39b7e621 by hfpp2012 yinsigan

paginate

1 parent f4518035
...@@ -9,7 +9,8 @@ class UsersController extends Controller ...@@ -9,7 +9,8 @@ class UsersController extends Controller
{ {
public function index() public function index()
{ {
$users = User::all(); $users = User::paginate(5);
// $users = User::simplePaginate(5);
return view('admin.users.index', compact('users')); return view('admin.users.index', compact('users'));
} }
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
@section('content') @section('content')
<div class="row"> <div class="row">
<div class="col-md-6 col-md-offset-3"> <div class="col-md-6 col-md-offset-3">
<h3>{{ $users->total() }} total users</h3>
<b>In this page {{ $users->count() }} users</b>
<ul class='list-group'> <ul class='list-group'>
@foreach($users as $user) @foreach($users as $user)
<li class='list-group-item' style="margin-top: 20px;"> <li class='list-group-item' style="margin-top: 20px;">
...@@ -14,6 +16,7 @@ ...@@ -14,6 +16,7 @@
</li> </li>
@endforeach @endforeach
</ul> </ul>
{{ $users->links() }}
</div> </div>
</div> </div>
@endsection @endsection
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!