mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-22 19:22:19 +00:00
34 lines
617 B
PHP
Executable File
34 lines
617 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Actions\Site;
|
|
|
|
use App\Exceptions\SSHError;
|
|
use App\Models\Site;
|
|
use App\SSH\Git\Git;
|
|
|
|
class UpdateBranch
|
|
{
|
|
/**
|
|
* @param array<string, mixed> $input
|
|
*
|
|
* @throws SSHError
|
|
*/
|
|
public function update(Site $site, array $input): void
|
|
{
|
|
$site->branch = $input['branch'];
|
|
app(Git::class)->fetchOrigin($site);
|
|
app(Git::class)->checkout($site);
|
|
$site->save();
|
|
}
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
public static function rules(): array
|
|
{
|
|
return [
|
|
'branch' => 'required',
|
|
];
|
|
}
|
|
}
|