From b895cdc9220347f0c9810652caf68f4309e96575 Mon Sep 17 00:00:00 2001 From: Refringe Date: Mon, 7 Oct 2024 09:54:39 -0600 Subject: [PATCH] Mod Listing Page - Default Value Method Small refactor to use a method to fetch the default value for SPT Version filters. --- app/Livewire/Mod/Listing.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/Livewire/Mod/Listing.php b/app/Livewire/Mod/Listing.php index 78942e2..7b3e25a 100644 --- a/app/Livewire/Mod/Listing.php +++ b/app/Livewire/Mod/Listing.php @@ -76,7 +76,15 @@ class Listing extends Component return SptVersion::getVersionsForLastThreeMinors(); }); - $this->sptVersions = $this->sptVersions ?? $this->getLatestMinorVersions()->pluck('version')->toArray(); + $this->sptVersions = $this->sptVersions ?? $this->getDefaultSptVersions(); + } + + /** + * Get the default values for the SPT Versions filter. + */ + protected function getDefaultSptVersions(): array + { + return $this->getLatestMinorVersions()->pluck('version')->toArray(); } /** @@ -145,7 +153,7 @@ class Listing extends Component public function resetFilters(): void { $this->query = ''; - $this->sptVersions = $this->getLatestMinorVersions()->pluck('version')->toArray(); + $this->sptVersions = $this->getDefaultSptVersions(); $this->featured = 'include'; }