return Property::whereHas('portals', function ($query) {
$query->where('portal_id', '=', '1');
})->get();
After executing this query I check each line.
The problem is that before doing the check the php has a memory error
PHP Fatal error: Allowed memory size of 16777216 bytes exhausted
In local environment I changed memory_limit in php.ini to 512M and the function ran OK. The problem is that this is not a solution for me, that I will run this on an online server.
I need to split this result before running the check, but I do not know how, can anyone help me?