mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 05:56:16 +00:00
34 lines
707 B
PHP
Executable File
34 lines
707 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Actions\Site;
|
|
|
|
use App\Models\DeploymentScript;
|
|
use App\Models\Site;
|
|
use Illuminate\Support\Facades\Validator;
|
|
|
|
class UpdateDeploymentScript
|
|
{
|
|
/**
|
|
* @param array<string, mixed> $input
|
|
*/
|
|
public function update(Site $site, array $input): void
|
|
{
|
|
Validator::make($input, self::rules())->validate();
|
|
|
|
/** @var DeploymentScript $script */
|
|
$script = $site->deploymentScript;
|
|
$script->content = $input['script'];
|
|
$script->save();
|
|
}
|
|
|
|
/**
|
|
* @return array<string, array<string>>
|
|
*/
|
|
public static function rules(): array
|
|
{
|
|
return [
|
|
'script' => ['required', 'string'],
|
|
];
|
|
}
|
|
}
|