credit < 0 || $userProducer->credit > 0; } public function filterPointsSaleByExclusiveAccess(UserProducer $userProducer, array $pointsSaleArray = []): array { if(!$userProducer->getExclusiveAccessSelectedPointsSale()) { return $pointsSaleArray; } $filteredPointsSaleArray = []; foreach($pointsSaleArray as $pointSale) { $idPointSale = is_array($pointSale) ? $pointSale['id'] : $pointSale->id; foreach($userProducer->user->userPointSale as $userPointSale) { if($idPointSale == $userPointSale->pointSale->id) { $filteredPointsSaleArray[] = $pointSale; } } } return $filteredPointsSaleArray; } }