How to merge a collection and a query builder in laravel then use paginate
I have +30K items in my requests table. The problem is that every user does not have permission to see all the requests and it's based on a lot of factors which i made a function that returns whether the user have permission to see such a request or not.
The problem is that the requests in process i have to pass every request in process to the function to get the permission ( processing request is a small set of items so it's okay to filter them one by one). So i used the filter function on processing requests and it gives me a collection of 10 items. Now i want to merge the big set of items which is closed requests that can be +10K items with the processing ones ( the small set of items) and use the paginate feature.
How can i do that ?
I tried to use union on on the query builder and the collection but it does not work and it generate an error saying
Call to a member function getBindings() on array
Please or to participate in this conversation.