Laravel Pagination

Pagination Controller:


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\user;

class Pagination extends Controller
    public function paginate(){
    	// $users = User::all();
    	$users = User::paginate(8);
    	return view('pagination',compact('users'));

Routing: routes > web.php



<!DOCTYPE html>
<html lang="en">
	<meta charset="UTF-8">
	<link rel="stylesheet" href="/css/bootstrap.css" crossorigin="anonymous">
	<div class="container">
		<div class="row">
			<div class="col-lg-6 offset-lg-3">
				<center><h2>Laravel Pagination</h2></center>
				<table class="table table-hover">
							<th scope="col">No</th>
							<th scope="col">Name</th>
							<th scope="col">Email</th>      
						@foreach ($users as $user)

Customizing The Pagination View

However, the easiest way to customize the pagination views is by exporting them to your resources/views/vendor directory using the vendor:publish command:

php artisan vendor:publish --tag=laravel-pagination

This command will place the views in the resources/views/vendor/pagination directory. The default.blade.php file within this directory corresponds to the default pagination view. Edit this file to modify the pagination HTML.

Using default bootstrap


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s