Commit 39b7e621 by hfpp2012 yinsigan

paginate

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