user(); return $user instanceof PlatformUser && $user->hasCapability(PlatformCapabilities::DIRECTORY_VIEW); } public function mount(Workspace $workspace): void { $workspace->loadCount('tenants'); $this->workspace = $workspace; } /** * @return Collection */ public function workspaceTenants(): Collection { return Tenant::query() ->where('workspace_id', (int) $this->workspace->getKey()) ->orderBy('name') ->limit(10) ->get(['id', 'name', 'status', 'workspace_id']); } /** * @return Collection */ public function recentRuns(): Collection { return OperationRun::query() ->where('workspace_id', (int) $this->workspace->getKey()) ->latest('id') ->limit(8) ->get(['id', 'type', 'created_at']) ->map(fn (OperationRun $run): array => [ 'id' => (int) $run->getKey(), 'label' => OperationCatalog::label((string) $run->type), 'started' => $run->created_at?->diffForHumans() ?? '—', 'url' => SystemOperationRunLinks::view($run), ]); } public function adminWorkspaceUrl(): string { return SystemDirectoryLinks::adminWorkspace($this->workspace); } public function runsUrl(): string { return SystemOperationRunLinks::index(); } }