New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

oval/laravel-pagination

Pagination helper library for Laravel
746 1
Install
composer require oval/laravel-pagination
Latest Version:v1.4.5
PHP:>=5.3.0
License:MIT
Last Updated:Jan 13, 2015
Links: GitHub  ·  Packagist
Maintainer: jamestrusleroval

PHP_Laravel_Pagination

Include our library using the composer name: oval/laravel-pagination

View:

$Model->items was passed from our controller and contains the response from the database(see model)

<?=$Model->items->appends( Input::except('page') )->links();?>

Controller:

Here is an example of a controller method

public function Test()
{
    
    $paginationViewModel = new PaginationViewModel();
    $paginationModel = new PaginationModel();
    
    $paginationModel->amount = 50;
    $paginationModel->columns[ "projectTitle" ] = new PaginationColumn( "project_title", Input::get( "projectTitle" ), Input::get('projectTitleSort') );
    $paginationModel->columns[ "partners" ] = new PaginationColumn( "partners", Input::get( "partners" ), Input::get('partnersSort') );        
    $paginationModel->page = isset( $_GET[ "page" ] ) ? $_GET[ "page" ] : 0;
    
    $paginationViewModel->paginationModel = $paginationModel;
    $paginationViewModel->items = $this->yourRepository->GetWithPagination( $paginationModel );
    
    return View::make('whatever/test', array( "Model" => $paginationViewModel ) );
    
}

Model:

This is the GetWithPagination method we set up in our "yourRepository"

public function GetWithPagination( PaginationModel $paginationModel )
{
    $query = DB::table('tablename');   
    $whatevers = $query->paginate( PaginationHelper::PrepareForDb( $query, $paginationModel ) );
    return $whatevers;
}

Related Packages

styde/blade-pagination

Laravel's pagination with Blade templating support

14,436 70
thinkme/pagination

Laravel pagination on steroids

281 2
revolution/laravel-pagination-bulma

Laravel pagination template for Bulma

13,245 6
usmanhalalit/strana

Pagination library for PHP, framework agnostic, with built-in adapters for Doctr...

7,417 93
chelout/offset-pagination

Offset pagination made easy for Laravel

4,963 4

Version History

Version Released PHP License
v1.4.5 >=5.3.0 MIT
1.4.4 >=5.3.0 MIT
v1.4.3 >=5.3.0 MIT
v1.4.2 >=5.3.0 MIT
v1.4.1 >=5.3.0 MIT