35 lines
883 B
PHP
35 lines
883 B
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Http\SymfonyCastDl\SymfonyCastDlService;
|
|
use App\Models\Chapter;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class DownloadVideoFile implements ShouldQueue, ShouldBeUnique
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
public const NAME = 'downloadVideoFile';
|
|
|
|
public function __construct(private int $chapterId)
|
|
{
|
|
$this->onQueue(self::NAME);
|
|
}
|
|
|
|
public function uniqueId(): string
|
|
{
|
|
return $this->chapterId;
|
|
}
|
|
|
|
public function handle(SymfonyCastDlService $symfonyCastDlService)
|
|
{
|
|
$symfonyCastDlService->downloadFile(Chapter::find($this->chapterId));
|
|
}
|
|
}
|