Files
animethemes-server/app/Actions/Storage/Wiki/Video/Script/MoveScriptAction.php
T
paranarimasu 8b6b196c99 feat(admin): migrate db dumps from github to platform (#465)
* feat: migrate encoding scripts from github to platform

* style: fix StyleCI finding

* fix: don't concatenate updated videos when attempting to attach entry on video upload

* fix(api): fix field dependencies & feat(admin): upload script from video detail screen
2022-09-24 00:01:37 -05:00

65 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Actions\Storage\Wiki\Video\Script;
use App\Actions\Storage\Base\MoveAction;
use App\Constants\Config\VideoConstants;
use App\Models\Wiki\Video\VideoScript;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Config;
/**
* Class MoveVideoAction.
*
* @extends MoveAction<VideoScript>
*/
class MoveScriptAction extends MoveAction
{
/**
* Create a new action instance.
*
* @param VideoScript $script
* @param string $to
*/
public function __construct(VideoScript $script, string $to)
{
parent::__construct($script, $to);
}
/**
* The list of disk names.
*
* @return array
*/
public function disks(): array
{
return Arr::wrap(Config::get(VideoConstants::SCRIPT_DISK_QUALIFIED));
}
/**
* Get the path to move from.
*
* @return string
*/
protected function from(): string
{
return $this->model->path;
}
/**
* Update underlying model.
* We want to apply these updates through Eloquent to preserve relations when renaming.
* Otherwise, reconciliation would destroy the old model and create a new model for the new name.
*
* @return void
*/
protected function update(): void
{
$this->model->update([
VideoScript::ATTRIBUTE_PATH => $this->to,
]);
}
}