Skip to content

Commit

Permalink
fix: restore media relation
Browse files Browse the repository at this point in the history
* fix: restore media_id

* typos

* tag param optional
  • Loading branch information
glennmichael123 authored May 21, 2021
1 parent cf95c5d commit 4836ee6
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/Jobs/CreateVideoConversion.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ class CreateVideoConversion implements ShouldQueue
private array $jobSettings;

/**
* @var array
* @var int
*/
private int $metaData;
private int $mediaId;

/**
* @var array
Expand All @@ -32,14 +32,17 @@ class CreateVideoConversion implements ShouldQueue
* Create a new job instance.
*
* @param array $jobSettings
* @param array $metadata
* @param array $tags
* @param int $mediaId
*/
public function __construct($jobSettings, $metaData = [], $tags = [])
public function __construct($jobSettings, $tags = [], $mediaId = null)
{
$this->jobSettings = $jobSettings;
$this->metaData = $metaData;
$this->tags = $tags;

if ($mediaId) {
$this->mediaId = $mediaId;
}
}

/**
Expand All @@ -49,6 +52,13 @@ public function __construct($jobSettings, $metaData = [], $tags = [])
*/
public function handle()
{
MediaConvert::createJob($this->jobSettings, $this->metaData, $this->tags);
$metaData = [];
$tags = $this->tags;

if ($this->mediaId) {
$metaData = ['model_id' => $this->mediaId];
}

MediaConvert::createJob($this->jobSettings, $metaData, $tags);
}
}

0 comments on commit 4836ee6

Please sign in to comment.