PHP code example of flagstudio / laravel-paginate

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

    

flagstudio / laravel-paginate example snippets


collect($posts)->paginate(5); // From Collection instance
Post::orderBy('created_at', 'desc')->get()->paginate(5); // From Collection instance
Post::orderBy('created_at', 'desc')->paginate(5); // From Builder instance

collect($posts)->paginateFirstDifferent(10, 5); // From Collection instance
Post::orderBy('created_at', 'desc')->get()->paginateFirstDifferent(10, 5); // From Collection instance
Post::orderBy('created_at', 'desc')->paginateFirstDifferent(10, 5); // From Builder instance

Post::orderBy('created_at', 'desc')->paginateFirstDifferent(10, 5, true);

collect($posts)->paginateWithPrevious(5); // From Collection instance
Post::orderBy('created_at', 'desc')->get()->paginateWithPrevious(5); // From Builder instance
Post::orderBy('created_at', 'desc')->paginateWithPrevious(5); // From Builder instance