mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 14:06:15 +00:00
init
This commit is contained in:
32
app/Actions/Site/UpdateDeploymentScript.php
Executable file
32
app/Actions/Site/UpdateDeploymentScript.php
Executable file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Site;
|
||||
|
||||
use App\Models\Site;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class UpdateDeploymentScript
|
||||
{
|
||||
/**
|
||||
* @throws ValidationException
|
||||
*/
|
||||
public function update(Site $site, array $input): void
|
||||
{
|
||||
$this->validate($input);
|
||||
|
||||
$site->deploymentScript()->update([
|
||||
'content' => $input['script'],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ValidationException
|
||||
*/
|
||||
protected function validate(array $input): void
|
||||
{
|
||||
Validator::make($input, [
|
||||
'script' => 'required',
|
||||
])->validateWithBag('updateDeploymentScript');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user