PHP code example of dvsouto / laravel-json-paginate

1. Go to this page and download the library: Download dvsouto/laravel-json-paginate 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/ */

    

dvsouto / laravel-json-paginate example snippets


'providers' => [
    ...
    Bitnary\JsonPaginate\JsonPaginateServiceProvider::class, // Bitnary JsonPaginate for o Eloquent
];

    ...
    $app->register(Bitnary\JsonPaginate\JsonPaginateServiceProvider::class); // Bitnary JsonPaginate for o Eloquent

YourModel::jsonPaginate();

YourModel::where('my_field', 'myValue')->jsonPaginate();

$per_page = 10; // 10 Results per page
$each_side = 3; // 3 buttons on each side

YourModel::jsonPaginate($per_page, $each_side);

$maxResults = 10;

YourModel::jsonPaginate($maxResults);