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

Pagination #154

Open
jicao opened this issue Jan 24, 2017 · 7 comments
Open

Pagination #154

jicao opened this issue Jan 24, 2017 · 7 comments

Comments

@jicao
Copy link

jicao commented Jan 24, 2017

Hello,

(First, GREAT WORK ! Thanks)

I can't get the pagination to work...

When I put "users_per_page" => 1, and then insert 2 users into my app db, when I want to click on the arrow (It detects tha pagination is needed!) to go to next page, it links me to http://myapp.com/?page=2 and even if I manually put "http://myapp.com/admin/users/list?page=2", there is no error but it's the "first page" with the first user that is shown. I can't see the second one.

Any help ?

Thanks

@jicao
Copy link
Author

jicao commented Feb 2, 2017

Hello,

Did anyone has the same trouble or it's just me ?

Thanks

@leekul
Copy link

leekul commented Feb 20, 2017

Having the same issue. Pagination doesnt work for user list and the list doesn't recognize more than "users_per_page" value. Even if you add more users, the dashboard would only show total of "users_per_page"-value users. The users table in DB does have all the users added.
Like @jicao mentioned, clicking the next arrow only takes you to the homepage. Even manually editing the url would only return the first page.

@intrip
Copy link
Owner

intrip commented Feb 20, 2017

What version or Laravel are you using?

@leekul
Copy link

leekul commented Feb 20, 2017

Laravel 5.3.30

@leekul
Copy link

leekul commented Feb 20, 2017

Update: Was able to fix the pagination issue on the user list page by using paginate method on the return of all() in app/Authentication/Repository/UserRepositorySearchFilter.php. Havent tested to ensure any other regression exists. Not quite sure why the array_unique is used there either since user emails will be unique as per DB. So I basically replaced:

    `
    $users = $q->get()->all();
    $user_emails = array_flip(array_map((function ($element)
    {
        return $element->email;
    }), $users));
    $users_emails_unique = array_unique($user_emails);
    $results = array_only($users, array_values($users_emails_unique));

    return new Paginator($results, $this->per_page);`

with

return $q->paginate($this->per_page);

Not the best solution i guess, but it works for the time being.
Dashboard values are still dependent on the values set in acl_base though.

@jicao
Copy link
Author

jicao commented Feb 22, 2017

FYI : # php artisan --version
Laravel Framework version 5.3.28

This solved my problem !
Don't know why you're saying it's not the best solution but working for me right now :)

Thanks.

@leekul
Copy link

leekul commented Feb 22, 2017

@jicao : I didnt test the other usages of the function to make sure something else didn't stop working. ;) Thats why I mentioned that its probably not the best solution. But yes, the pagination on the user list does work after this change.

@jicao jicao closed this as completed Feb 23, 2017
@jicao jicao reopened this Feb 23, 2017
@intrip intrip self-assigned this Mar 31, 2017
@intrip intrip added the bug label Mar 31, 2017
@intrip intrip removed their assignment Dec 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants