Laravel Next Previous Link Button Pagination

Laravel Next Previous Link Button Pagination

In this post we will give you information about Laravel Next Previous Link Button Pagination. Hear we will give you detail about Laravel Next Previous Link Button PaginationAnd how to use it also give you demo for it if it is necessary.

Do you want to add next previous button on pagination in laravel 6?, if yes then i will help you to create simple pagination with laravel 6. we will customize pagination link with only next and previous button in laravel 6.

we can add next and previous link on pagination using simplePaginate() in laravel 6 and laravel 5 application. laravel provide new eloquent method simplePaginate() for adding simple pagination with only next previous button link.

If you also want to add pagination with next and previous link then follow bellow some step and make it done as like bellow screen shot:

Create Route:

In first step, we will create simple routes for getting users and view it, so let’s add new route in web.php file:

routes/web.php

Route::get('users', 'UserController@index');

Create Controller:

Now, we will create new UserController with index() method. in index() we will write simple pagination code. so let’s create as like bellow:

app/Http/Controllers/UserController.php

<?php

namespace AppHttpControllers;

use IlluminateHttpRequest;

use AppUser;

class UserController extends Controller

{

/**

* The attributes that are mass assignable.

*

* @var array

*/

public function index()

{

$users = User::simplePaginate(5);

return view('users', compact('users'));

}

}

Create View File:

In this last step, we will create simple blade file and display users with pagination. so let’s add bellow code:

resources/views/users.blade.php

<!DOCTYPE html>

<html>

<head>

<title>Laravel Next Previous Link Button Pagination - ItSolutionStuff.com</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">

</head>

<body>

<div >

<h1>Laravel Next Previous Link Button Pagination - ItSolutionStuff.com</h1>

<table >

<tr>

<th>ID</th>

<th>Name</th>

</tr>

@foreach($users as $user)

<tr>

<td>{{ $user->id }}</td>

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

</tr>

@endforeach

</table>

{{ $users->links() }}

</div>

</body>

</html>

Ok, now you have to create some dummy records on users table.

Then you can check it.

I hope it can help you…

Hope this code and post will helped you for implement Laravel Next Previous Link Button Pagination. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

  +  52  =  62

We accept paid advance and paid guest Posting on our Site : Contact US