*/ protected function getViewData(): array { $tenant = Filament::getTenant(); if (! $tenant instanceof Tenant) { return [ 'pollingInterval' => null, 'runs' => collect(), 'viewRunBaseUrl' => null, ]; } $tenantId = (int) $tenant->getKey(); /** @var Collection $runs */ $runs = OperationRun::query() ->where('tenant_id', $tenantId) ->latest('created_at') ->limit(10) ->get() ->each(function (OperationRun $run) use ($tenant): void { $run->setAttribute('type_label', OperationCatalog::label((string) $run->type)); $run->setAttribute('view_url', OperationRunLinks::view($run, $tenant)); }); return [ 'pollingInterval' => ActiveRuns::existForTenant($tenant) ? '10s' : null, 'runs' => $runs, ]; } }