mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-09-03 11:15:04 +02:00
* feat(admin): allow overwriting and skipping source video derivation for backfilling audio * test: fix video streaming test
62 lines
1.3 KiB
PHP
62 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Actions\Models\Wiki\Studio;
|
|
|
|
use App\Actions\Models\Wiki\BackfillImageAction;
|
|
use App\Models\Wiki\Image;
|
|
use App\Models\Wiki\Studio;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
/**
|
|
* Class BackfillStudioImageAction.
|
|
*
|
|
* @extends BackfillImageAction<Studio>
|
|
*/
|
|
abstract class BackfillStudioImageAction extends BackfillImageAction
|
|
{
|
|
/**
|
|
* Create a new action instance.
|
|
*
|
|
* @param Studio $studio
|
|
*/
|
|
public function __construct(Studio $studio)
|
|
{
|
|
parent::__construct($studio);
|
|
}
|
|
|
|
/**
|
|
* Get the model the action is handling.
|
|
*
|
|
* @return Studio
|
|
*/
|
|
protected function getModel(): Studio
|
|
{
|
|
return $this->model;
|
|
}
|
|
|
|
/**
|
|
* Get the relation to images.
|
|
*
|
|
* @return BelongsToMany
|
|
*/
|
|
protected function relation(): BelongsToMany
|
|
{
|
|
return $this->getModel()->images();
|
|
}
|
|
|
|
/**
|
|
* Attach Image to Studio.
|
|
*
|
|
* @param Image $image
|
|
* @return void
|
|
*/
|
|
protected function attachImage(Image $image): void
|
|
{
|
|
Log::info("Attaching Image '{$image->getName()}' to {$this->label()} '{$this->getModel()->getName()}'");
|
|
$this->relation()->attach($image);
|
|
}
|
|
}
|