I have 1 pagination query for every:
$pagination_query = Table1::...->paginate(100);
then I have a second query that needs to use the list of ids from the pagination query:
$second_query = Table2::whereIn('id', $list_of_ids_from_pagination_query);
How can I get the list of ids only from the paginated page so that I get 100 ids and not thousands of ids which will end up in too many bound variables error?
Ty!
>Solution :
You can use something like this .
$ids = Table1::...->paginate(100)->pluck('id');
$second_query = Table2::wherein('id', $ids);