API Feature (#334)

This commit is contained in:
Saeed Vaziry
2024-11-01 16:49:57 +01:00
committed by GitHub
parent da7b24640e
commit 417bf73e44
143 changed files with 36520 additions and 586 deletions

View File

@ -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();