mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 05:56:16 +00:00
API Feature (#334)
This commit is contained in:
@ -3,17 +3,16 @@
|
||||
namespace App\Actions\StorageProvider;
|
||||
|
||||
use App\Models\StorageProvider;
|
||||
use Exception;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class DeleteStorageProvider
|
||||
{
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function delete(StorageProvider $storageProvider): void
|
||||
{
|
||||
if ($storageProvider->backups()->exists()) {
|
||||
throw new Exception('This storage provider is being used by a backup.');
|
||||
throw ValidationException::withMessages([
|
||||
'provider' => __('This storage provider is being used by a backup.'),
|
||||
]);
|
||||
}
|
||||
|
||||
$storageProvider->delete();
|
||||
|
Reference in New Issue
Block a user