mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-20 18:31:36 +00:00
21 lines
494 B
PHP
21 lines
494 B
PHP
<?php
|
|
|
|
namespace App\Actions\StorageProvider;
|
|
|
|
use App\Models\StorageProvider;
|
|
use Illuminate\Validation\ValidationException;
|
|
|
|
class DeleteStorageProvider
|
|
{
|
|
public function delete(StorageProvider $storageProvider): void
|
|
{
|
|
if ($storageProvider->backups()->exists()) {
|
|
throw ValidationException::withMessages([
|
|
'provider' => __('This storage provider is being used by a backup.'),
|
|
]);
|
|
}
|
|
|
|
$storageProvider->delete();
|
|
}
|
|
}
|