mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-04 15:32:35 +00:00
#591 - server-logs
This commit is contained in:
@ -1,11 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Server;
|
||||
namespace App\Actions\ServerLog;
|
||||
|
||||
use App\Models\Server;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class CreateServerLog
|
||||
class CreateLog
|
||||
{
|
||||
/**
|
||||
* @param array<string, mixed> $input
|
||||
@ -14,6 +15,8 @@ class CreateServerLog
|
||||
*/
|
||||
public function create(Server $server, array $input): void
|
||||
{
|
||||
Validator::make($input, self::rules())->validate();
|
||||
|
||||
$server->logs()->create([
|
||||
'is_remote' => true,
|
||||
'name' => $input['path'],
|
34
app/Actions/ServerLog/UpdateLog.php
Executable file
34
app/Actions/ServerLog/UpdateLog.php
Executable file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\ServerLog;
|
||||
|
||||
use App\Models\ServerLog;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class UpdateLog
|
||||
{
|
||||
/**
|
||||
* @param array<string, mixed> $input
|
||||
*
|
||||
* @throws ValidationException
|
||||
*/
|
||||
public function update(ServerLog $serverLog, array $input): void
|
||||
{
|
||||
Validator::make($input, self::rules())->validate();
|
||||
|
||||
$serverLog->update([
|
||||
'name' => $input['path'],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function rules(): array
|
||||
{
|
||||
return [
|
||||
'path' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user