This commit is contained in:
Saeed Vaziry
2023-07-02 12:47:50 +02:00
commit 5c72f12490
825 changed files with 41659 additions and 0 deletions

View File

@ -0,0 +1,33 @@
<?php
namespace App\Actions\Server;
use App\Models\Server;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\ValidationException;
class DeleteServer
{
/**
* @throws ValidationException
*/
public function delete(Server $server, array $input): void
{
$this->validateDelete($input);
DB::transaction(function () use ($server) {
$server->cleanDelete();
});
}
/**
* @throws ValidationException
*/
protected function validateDelete(array $input): void
{
Validator::make($input, [
'confirm' => 'required|in:delete',
])->validateWithBag('deleteServer');
}
}