Skip to content

[Proposal] Support multiple paginations in 1 page #3868

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

Closed
wants to merge 4 commits into from
Closed

[Proposal] Support multiple paginations in 1 page #3868

wants to merge 4 commits into from

Conversation

vgoodvin
Copy link

The problem description: #164
I sugest passing $pageName in paginate() method.

How to use:

Model1::paginate(15, array('*')); // By default 'page' will be used
Model2::paginate(15, array('*'), 'page2');

In views:

$model1_objects->appends('page2', Input::get('page2', 1))->links(); 
...
$model2_objects->appends('page', Input::get('page', 1))->links();

Using appends() is optional.

@taylorotwell
Copy link
Member

I would suggest not making any changes on the Eloquent and query builders. Just have a pageName method on the Paginator. It's a lot of code changes to add the page name all over the place in Eloquent and query builder and I think you shuold just make two calls like:

$users = User::paginate()->pageName('foo');

@taylorotwell
Copy link
Member

Do you want me to make those changes for you or are you planning on doing it?

@vgoodvin
Copy link
Author

I'll do it tomorrow. Thank you!

@JoostK
Copy link
Contributor

JoostK commented Mar 15, 2014

@taylorotwell How will User::paginate()->pageName('foo'); determine the current page from the paginate() method, it doesn't know the query param name...

@vgoodvin
Copy link
Author

Yes. I think it is impossible until laravel application uses 1 instance of Environment class for all pagers.

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

Successfully merging this pull request may close these issues.

3 participants