In this tutorial, we will learn Laravel Pagination Get Total Page Example.

In this section, you will know how to get the total page pagination laravel.

You can easily do Pagination current Button in laravel.

Create Route:


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

Create Controller:


namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\User;
class UserController extends Controller
     * The attributes that are mass assignable.
     * @var array
    public function index()
        $users = User::paginate(10)->total();
        return view('users', compact('users'));

Create View File:


<!DOCTYPE html>
    <title>Laravel Pagination Get Total Page Example -</title>
    <link rel="stylesheet" href="">
<div class="container">
    <h1>Laravel Pagination Get total Page Example -</h1>
    <table class="table table-bordered">
        @foreach($users as $user)
            <td>{{ $user->id }}</td>
            <td>{{ $user->name }}</td>
    {{ $users->links() }}

May this example help you.