SoftwareUpdateRefresh.php 844 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. use App\Services\Internal\SoftwareUpdateService;
  5. use Cache;
  6. class SoftwareUpdateRefresh extends Command
  7. {
  8. /**
  9. * The name and signature of the console command.
  10. *
  11. * @var string
  12. */
  13. protected $signature = 'app:software-update-refresh';
  14. /**
  15. * The console command description.
  16. *
  17. * @var string
  18. */
  19. protected $description = 'Refresh latest software version data';
  20. /**
  21. * Execute the console command.
  22. */
  23. public function handle()
  24. {
  25. $key = SoftwareUpdateService::cacheKey();
  26. Cache::forget($key);
  27. Cache::remember($key, 1209600, function() {
  28. return SoftwareUpdateService::fetchLatest();
  29. });
  30. $this->info('Succesfully updated software versions!');
  31. }
  32. }