Laravel 5 Pagination example

By Hardik Savani September 6, 2020 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() !!}