/** * @author WN * @param string $externalId * @param Collection $installations * @return bool */ private function isNewInstallation($externalId, Collection $installations) { $item = $installations->search(function ($item) use($externalId, $installations) { if ($item->ext_id == $externalId) { return true; } return false; }); if ($item !== false) { $installations->forget($item); return false; } return true; }