overtrue/laravel-like

Support for laravel cursor paginate?

timmaier opened this issue · 2 comments

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;

Can you submit a PR? Thanks

Thanks for this!