Mod Listing Page - Default Value Method

Small refactor to use a method to fetch the default value for SPT Version filters.
This commit is contained in:
Refringe 2024-10-07 09:54:39 -06:00
parent 75b8be1e1e
commit b895cdc922
Signed by: Refringe
SSH Key Fingerprint: SHA256:t865XsQpfTeqPRBMN2G6+N8wlDjkgUCZF3WGW6O9N/k

View File

@ -76,7 +76,15 @@ class Listing extends Component
return SptVersion::getVersionsForLastThreeMinors(); 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 public function resetFilters(): void
{ {
$this->query = ''; $this->query = '';
$this->sptVersions = $this->getLatestMinorVersions()->pluck('version')->toArray(); $this->sptVersions = $this->getDefaultSptVersions();
$this->featured = 'include'; $this->featured = 'include';
} }