22 lines
523 B
PHP
22 lines
523 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Jobs\DownloadVideoFile;
|
|
use App\Models\Chapter;
|
|
use Illuminate\Console\Command;
|
|
|
|
class SyncFiles extends Command
|
|
{
|
|
protected $signature = 'symfonycast:sync';
|
|
|
|
protected $description = 'Downloads files locally for chapters marked as sync offline';
|
|
|
|
public function handle()
|
|
{
|
|
$chapters = Chapter::where('sync_offline', 1)->get();
|
|
$chapters->each(fn($chapter) => DownloadVideoFile::dispatch($chapter->id));
|
|
return self::SUCCESS;
|
|
}
|
|
}
|