33 lines
913 B
PHP
33 lines
913 B
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Domain\Catalog\Composition;
|
|
use App\Domain\Catalog\ContentElementVersion;
|
|
use App\Domain\Media\ThumbnailDeriver;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Queue\Queueable;
|
|
|
|
class DeriveCompositionFrame implements ShouldQueue
|
|
{
|
|
use Queueable;
|
|
|
|
public function __construct(
|
|
public readonly int $compositionId,
|
|
public readonly int $versionId,
|
|
public readonly float $atSecond,
|
|
) {}
|
|
|
|
public function handle(ThumbnailDeriver $deriver): void
|
|
{
|
|
$composition = Composition::query()->find($this->compositionId);
|
|
$version = ContentElementVersion::query()->find($this->versionId);
|
|
|
|
if (! $composition instanceof Composition || ! $version instanceof ContentElementVersion) {
|
|
return;
|
|
}
|
|
|
|
$deriver->forCompositionFrame($composition, $version, $this->atSecond);
|
|
}
|
|
}
|