I want to have collection of Users with the Type A and a collection of Users with Type B,How to do that?

hey guys question, I want to query the database from the Users table where user type is either A or B, but I want to eventually split them up and paginate separately (example 10 each) . In the end I want to have collection of Users with the Type A and a collection of Users with Type B , both are paginated at 10 items per page. Is that possible? or do I need to query them separately?
You already invited:

redXylo

Upvotes from:

It's certainly possible to execute a single query and then sort the records by type. Collections have a where()method that would make this trivial. As to which approach is faster, you'd have to benchmark to know for certain. ;)
 
But, given that you want to paginate, too, it probably makes sense just to treat the user types separately for this purpose (i.e., separate queries).

If you wanna answer this question please Login or Register