Laravel 5 Pagination example

By Hardik Savani | April 21, 2016 | Category : Laravel

In this tutorial you can learn how to add simple pagination in your blade file. If you are beginners then it can help you. Laravel 5 provide its own method for pagination. But if you are work on code PHP then you have to write long code for pagination and render view etc but in Laravel it is very simple so let's select data following way in Controller.

Controller File:

public function getUser()


$data = User::paginate(10);

return view('users.index',compact('data'));


In above example you can see now it will return pagination with 10 records if you want to 5 or 15 etc then you can change argument. Now we have to render pagination view so, let's see.

Blade File:



<table class="table table-bordered">




<th width="300px;">Action</th>




@if(!empty($data) && $data->count())

@foreach($data as $key => $value)


<td>{{ $value->name }}</td>


<button class="btn btn-danger">Delete</button>






<td colspan="10">There are no data.</td>





{!! $data->render() !!}


Hardik Savani
My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
Follow Me: Github Twitter
***Do you want me hire for your Project Work? Then Contact US.

We are Recommending you: