diff --git a/src/BaseCollection.php b/src/BaseCollection.php index 49f6632..1b841b4 100644 --- a/src/BaseCollection.php +++ b/src/BaseCollection.php @@ -54,6 +54,11 @@ abstract public function futureDateBehavior(): ?string; abstract public function pastDateBehavior(): ?string; + public function visible(): bool + { + return true; + } + public function register() { $collection = StatamicCollection::make($this->handle()) diff --git a/src/Repositories/CollectionRepository.php b/src/Repositories/CollectionRepository.php index 2ef9350..3cb421e 100644 --- a/src/Repositories/CollectionRepository.php +++ b/src/Repositories/CollectionRepository.php @@ -51,7 +51,7 @@ public function all(): IlluminateCollection $keys = $this->store->paths()->keys(); // add custom collections - $keys = $this->collections->keys()->merge($keys); + $keys = $this->collections->keys()->filter(fn ($collection) => $this->getCollectionByHandle($collection)->visible())->merge($keys); return $this->store->getItems($keys, $this->collections); }