teamId = currentTeam()->id; } public function render(): View { return view('livewire.deploy-canvas', [ 'serviceTemplates' => $this->serviceTemplates(), 'serviceLogos' => $this->serviceLogos(), 'resourceLogos' => $this->resourceLogos(), // Only shows the "New project / environment" rows; the API checks again. 'canAddProjects' => auth()->user()->can('create', Project::class), ])->layout('layouts.app', ['fullBleed' => true]); } /** * The versioned URLs of the logos in public/svgs/resources for the step icons: name => URL. * * @return array */ private function resourceLogos(): array { return collect(glob(public_path('svgs/resources/*.svg')) ?: []) ->mapWithKeys(fn (string $path): array => [basename($path, '.svg') => resource_logo_url(basename($path, '.svg'))]) ->all(); } /** * Service template logos for the Service step icon, as resource_logo() shows them: * template key => [logo URL, CDN fallback URL]. Templates without a logo are left out. * * @return array */ private function serviceLogos(): array { return get_service_templates() ->map(fn ($template): mixed => data_get($template, 'logo')) ->filter(fn (mixed $logo): bool => is_string($logo) && $logo !== '' && basename($logo) !== 'default.webp') ->map(function (string $logo): array { $urls = service_logo_urls($logo); return [$urls['logo'], $urls['logo_cdn_url']]; }) ->all(); } /** * One-click service templates for the Service step: the keys that the * services API accepts, with the names of the New resource page. * * @return list */ private function serviceTemplates(): array { return get_service_templates()->keys() ->map(fn ($key): array => [(string) $key, str((string) $key)->headline()->value()]) ->sortBy(fn (array $template): string => strtolower($template[1])) ->values() ->all(); } }