mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 22:46:16 +00:00
init
This commit is contained in:
32
app/Actions/Site/DeleteSite.php
Executable file
32
app/Actions/Site/DeleteSite.php
Executable file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Site;
|
||||
|
||||
use App\Models\Site;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class DeleteSite
|
||||
{
|
||||
/**
|
||||
* @throws ValidationException
|
||||
*/
|
||||
public function handle(Site $site, array $input): void
|
||||
{
|
||||
$this->validateDelete($input);
|
||||
|
||||
$site->update(['status' => 'deleting']);
|
||||
|
||||
$site->remove();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ValidationException
|
||||
*/
|
||||
protected function validateDelete(array $input): void
|
||||
{
|
||||
Validator::make($input, [
|
||||
'confirm' => 'required|in:delete',
|
||||
])->validateWithBag('deleteSite');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user