mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-22 19:22:19 +00:00
- refactoring architecture - fix incomplete ssh logs - code editor for scripts in the app - remove Jobs and SSHCommands
33 lines
651 B
PHP
Executable File
33 lines
651 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Actions\Site;
|
|
|
|
use App\Models\Site;
|
|
use App\SSH\Git\Git;
|
|
use Illuminate\Support\Facades\Validator;
|
|
use Illuminate\Validation\ValidationException;
|
|
|
|
class UpdateBranch
|
|
{
|
|
/**
|
|
* @throws ValidationException
|
|
*/
|
|
public function update(Site $site, array $input): void
|
|
{
|
|
$this->validate($input);
|
|
$site->branch = $input['branch'];
|
|
app(Git::class)->checkout($site);
|
|
$site->save();
|
|
}
|
|
|
|
/**
|
|
* @throws ValidationException
|
|
*/
|
|
protected function validate(array $input): void
|
|
{
|
|
Validator::make($input, [
|
|
'branch' => 'required',
|
|
]);
|
|
}
|
|
}
|