mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-19 09:51:37 +00:00
36 lines
723 B
PHP
Executable File
36 lines
723 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Actions\Server;
|
|
|
|
use App\Models\Server;
|
|
use Illuminate\Support\Facades\Validator;
|
|
use Illuminate\Validation\ValidationException;
|
|
|
|
class CreateServerLog
|
|
{
|
|
/**
|
|
* @throws ValidationException
|
|
*/
|
|
public function create(Server $server, array $input): void
|
|
{
|
|
$this->validate($input);
|
|
|
|
$server->logs()->create([
|
|
'is_remote' => true,
|
|
'name' => $input['path'],
|
|
'type' => 'remote',
|
|
'disk' => 'ssh',
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* @throws ValidationException
|
|
*/
|
|
protected function validate(array $input): void
|
|
{
|
|
Validator::make($input, [
|
|
'path' => 'required',
|
|
])->validate();
|
|
}
|
|
}
|