Optimize code

This commit is contained in:
An Phan 2016-07-31 11:43:01 +08:00
parent 33708a2cbd
commit 23ea221d50
No known key found for this signature in database
GPG key ID: 05536BB4BCDC02A2

View file

@ -82,12 +82,12 @@ class Application extends IlluminateApplication
*/
public function getLatestVersion(Client $client = null)
{
$client = $client ?: new Client();
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