Support for laravel cursor paginate?
timmaier opened this issue · 2 comments
timmaier commented
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 commented
Can you submit a PR? Thanks
timmaier commented
Thanks for this!