Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default Pagination Limit #12

Open
nafiesl opened this issue Feb 9, 2020 · 3 comments
Open

Default Pagination Limit #12

nafiesl opened this issue Feb 9, 2020 · 3 comments

Comments

@nafiesl
Copy link
Contributor

nafiesl commented Feb 9, 2020

Hi @LIQRGV, I am using this package and try to fetch 13k records, and they loaded as my expectation. But I think it would be nice if we have a default pagination limit. I am thinking some of these terms:

  • We can set a default limit value in a config file.
  • The default pagination limit is null, means no limit.
  • We can create a child RequestParser class, and override the pagination limit with a class property.
<?php

namespace App\Http\Requests;

use Illuminate\Http\Request;
use LIQRGV\QueryFilter\RequestParser;

class BrowseInvoice extends RequestParser
{
    protected $pageLimit = 50;

    public function __construct(Request $request)
    {
        parent::__construct($request);
    }
}
@LIQRGV
Copy link
Owner

LIQRGV commented Nov 29, 2022

I think we can use some kind of trait of interface.
Like trait HasPagination or interface Paginationable and check that availability on the parser.

With that, we will extend it like this

public class ChildRequestParser extends RequestParser implement Paginationable {
.......
}

On the controller, it will be something like this

public function index(ChildRequestParser $parser) {
    $builder = $parser->getBuilder();
    // do something with builder
    .............
}

How's that sounds ?

@nafiesl
Copy link
Contributor Author

nafiesl commented Nov 29, 2022

Looks good, @LIQRGV let me know if you need any help implementing it.

@LIQRGV
Copy link
Owner

LIQRGV commented Nov 30, 2022

So, we will implement something like this.
https://github.com/SpartnerNL/Laravel-Excel/blob/3.1/src/Sheet.php#L209
We will check presence of Paginationable on the request class, wdyt @nafiesl ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants