Reputation: 24059
When I do
User::select('id')->get()
It returns a collection.
When I do:
User::select('id')->paginate(10)->items()
It returns an array.
Is there any method that returns the underlying collection of the model and not an array?
Note, I'm aware of collect(User::select('id')->paginate(10)->items())
.
Upvotes: 0
Views: 31
Reputation: 12208
you can use the method getCollection witch is earned from AbstractPaginator
$userscollection=User::select('id')->paginate(10)->getCollection();
now $userscollection
will be the underling collection you want.
Upvotes: 1