mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-04 23:42:34 +00:00
Merge (#127)
This commit is contained in:
@ -27,11 +27,18 @@ public function create(User $user, array $input): void
|
||||
|
||||
$storageProvider->credentials = $storageProvider->provider()->credentialData($input);
|
||||
|
||||
if (! $storageProvider->provider()->connect()) {
|
||||
try {
|
||||
if (! $storageProvider->provider()->connect()) {
|
||||
throw ValidationException::withMessages([
|
||||
'provider' => __("Couldn't connect to the provider"),
|
||||
]);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
throw ValidationException::withMessages([
|
||||
'provider' => __("Couldn't connect to the provider"),
|
||||
'provider' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
|
||||
$storageProvider->save();
|
||||
}
|
||||
|
||||
|
21
app/Actions/StorageProvider/DeleteStorageProvider.php
Normal file
21
app/Actions/StorageProvider/DeleteStorageProvider.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\StorageProvider;
|
||||
|
||||
use App\Models\StorageProvider;
|
||||
use Exception;
|
||||
|
||||
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.');
|
||||
}
|
||||
|
||||
$storageProvider->delete();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user