public function getLatestVersion(Client $client = null)
{
if ($v = Cache::get('latestKoelVersion')) {
return $v;
}
$client = $client ?: new Client();
try {
$v = json_decode($client->get('https://api.github.com/repos/phanan/koel/tags')->getBody())[0]->name;
// Cache for one day
Cache::put('latestKoelVersion', $v, 1 * 24 * 60);
return $v;
} catch (Exception $e) {
Log::error($e);
return self::VERSION;
}
}