PHP code example of romansh / laravel-pretty-pagination

1. Go to this page and download the library: Download romansh/laravel-pretty-pagination library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

romansh / laravel-pretty-pagination example snippets


use Illuminate\Support\Facades\Route;

Route::get('/users', [UserController::class, 'index'])
    ->name('users')
    ->paginate();

use App\Models\User;

public function index()
{
    return view('users.index', [
        'users' => User::query()->paginate(15),
    ]);
}

Route::get('/users', [UserController::class, 'index'])
    ->name('users')
    ->paginate('p');

Route::get('/users', [UserController::class, 'index'])
    ->name('users')
    ->paginate(null);

Route::get('/users', [UserController::class, 'index'])
    ->name('users')
    ->paginate('page', true);