private function getResellersByZones($zones) { $collection = []; foreach ($zones as $zone) { $z = Model::zonereseller()->where(['customzonereseller_id', '=', $zone['id']])->first(true); if ($z) { $reseller = $z->reseller(true); if ($reseller) { array_push($collection, $reseller->assoc()); } } } return $collection; }