service = $service; $this->authorize('update', $this->service); if ($this->databases->count() === 1) { $this->selectedDatabaseUuid = $this->databases->first()->uuid; } } /** * @return Collection */ #[Computed] public function databases(): Collection { return $this->service->databases ->filter(fn (ServiceDatabase $database): bool => str($database->databaseType())->contains(['mysql', 'mariadb', 'postgres', 'mongo'])) ->values(); } #[Computed] public function selectedDatabase(): ?ServiceDatabase { $database = $this->databases->firstWhere('uuid', $this->selectedDatabaseUuid); if (! $database instanceof ServiceDatabase) { return null; } $this->authorize('update', $database); return $database; } public function render(): View { return view('livewire.project.service.import-backup'); } }