serverId = $serverId; $this->ref = $ref; } public static function modalMaxWidth(): string { return 'lg'; } public function load(DockerService $docker): void { // Re-gate the actual read (not just the opener): logs can leak secrets → operate only. abort_unless(Auth::user()?->can('operate'), 403); // serverId 0 = the Clusev host (transient server from the host login); otherwise a fleet server. // The host is admin-only (manage-fleet), matching the host terminal + the Docker host target. if ($this->serverId === 0) { abort_unless(Auth::user()?->can('manage-fleet'), 403); } $server = $this->serverId === 0 ? HostCredential::current()?->toServer() : Server::find($this->serverId); if (! $server) { $this->error = __('common.server_not_found'); $this->loaded = true; return; } try { $this->logs = $docker->logs($server, $this->ref, 200); } catch (InvalidArgumentException) { $this->error = __('docker.invalid_ref'); } catch (Throwable $e) { $this->error = $e->getMessage(); } $this->loaded = true; } public function render() { return view('livewire.modals.container-logs'); } }