storage = S3Storage::ownedByCurrentTeam()->whereUuid(request()->storage_uuid)->first(); if (! $this->storage) { abort(404); } try { $this->authorize('view', $this->storage); } catch (AuthorizationException) { return $this->redirectRoute('storage.index', navigate: true); } $this->currentRoute = request()->route()->getName(); $this->backupCount = collect([ScheduledDatabaseBackup::class, ScheduledVolumeBackup::class]) ->sum(fn (string $backupModel): int => $backupModel::query() ->usingS3Storage($this->storage->id) ->count()); } public function delete() { try { $this->authorize('delete', $this->storage); $this->storage->delete(); return redirectRoute($this, 'storage.index'); } catch (\Throwable $e) { return handleError($e, $this); } } #[On('storage-status-changed')] public function refreshStorageStatus(bool $isUsable): void { $this->storage->refresh(); } public function render() { return view('livewire.storage.show'); } }