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

Support for laravel cursor paginate? #50

Closed
timmaier opened this issue Mar 31, 2022 · 2 comments
Closed

Support for laravel cursor paginate? #50

timmaier opened this issue Mar 31, 2022 · 2 comments

Comments

@timmaier
Copy link

I attempted to use this packages attachLikeStatus on a cursorPaginated eloquent model. Which doesn't seem to work. With normal pagination it works fine.

$listings = Listing::filterByRequest($request)
                       ->cursorPaginate($perPage);

$currentUser = Auth::user();
if (Auth::check()) {
    $listings = $currentUser->attachLikeStatus($listings);
}

I added a CursorPaginator handler to Liker.php trait and now the above works:

case $likeables instanceof CursorPaginator:
    $likeables = \collect($likeables->items());
    break;
@overtrue
Copy link
Owner

Can you submit a PR? Thanks

@timmaier
Copy link
Author

timmaier commented Apr 2, 2022

Thanks for this!

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