2024-08-15 17:57:35 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Services;
|
|
|
|
|
|
|
|
use App\Models\SptVersion;
|
|
|
|
|
2024-08-22 17:04:07 -04:00
|
|
|
/**
|
|
|
|
* This class is responsible for fetching the latest SPT version. It's registered as a singleton in the service
|
|
|
|
* container so that the latest version is only fetched once per request.
|
|
|
|
*/
|
2024-08-15 17:57:35 -04:00
|
|
|
class LatestSptVersionService
|
|
|
|
{
|
|
|
|
protected ?SptVersion $version = null;
|
|
|
|
|
|
|
|
public function getLatestVersion(): ?SptVersion
|
|
|
|
{
|
|
|
|
if ($this->version === null) {
|
|
|
|
$this->version = SptVersion::select('version')->orderByDesc('version')->first();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->version;
|
|
|
|
}
|
|
|
|
}
|