PHP code example of chelout / offset-pagination

1. Go to this page and download the library: Download chelout/offset-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/ */

    

chelout / offset-pagination example snippets


public function index()
{
    $users = DB::table('users')->offsetPaginate();
    
    return $users;
}

$users = User::offsetPaginate(5);

$users = User::where('votes', '>', 100)->offsetPaginate(5);

$users = User::orderBy('id', 'desc')->offsetPaginate(5);

Route::get('api/v1/users', function () {
    return App\User::offsetPaginate();
});
`bash
php artisan vendor:publish --provider="Chelout\OffsetPagination\CursorPaginationServiceProvider" --tag="config"