38 lines
761 B
PHP
38 lines
761 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Models\Downloads;
|
|
use App\Jobs\GetFileSizeFromCDN;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
class GetFileSize extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'app:get-file-size';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Get missing filesize from API (Job)';
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*/
|
|
public function handle()
|
|
{
|
|
foreach(Downloads::whereNull('size')->get() as $download) {
|
|
GetFileSizeFromCDN::dispatch($download->id);
|
|
}
|
|
|
|
$this->comment('Added all missing sizes to Job Queue!');
|
|
}
|
|
}
|