Automated PR created by Copilot per user request. Branch pushed: 266-tenant-dashboard-productization-v1 Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #322
47 lines
1.3 KiB
PHP
47 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Filament\Widgets\Dashboard;
|
|
|
|
use App\Models\Tenant;
|
|
use App\Support\TenantDashboard\TenantDashboardSummaryBuilder;
|
|
use Filament\Facades\Filament;
|
|
use Filament\Widgets\Widget;
|
|
|
|
class TenantDashboardContextChips extends Widget
|
|
{
|
|
protected static bool $isLazy = false;
|
|
|
|
protected int|string|array $columnSpan = 'full';
|
|
|
|
protected string $view = 'filament.widgets.dashboard.tenant-dashboard-context-chips';
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
protected function getViewData(): array
|
|
{
|
|
$tenant = Filament::getTenant();
|
|
|
|
if (! $tenant instanceof Tenant) {
|
|
return [
|
|
'context' => [
|
|
'workspace' => __('localization.dashboard.overview.context_workspace'),
|
|
'tenant' => __('localization.dashboard.overview.context_no_tenant'),
|
|
'provider' => null,
|
|
'providerKey' => null,
|
|
'latestActivity' => null,
|
|
],
|
|
'pollingInterval' => null,
|
|
];
|
|
}
|
|
|
|
$summary = app(TenantDashboardSummaryBuilder::class)->build($tenant, auth()->user());
|
|
|
|
return [
|
|
'context' => $summary->context,
|
|
'pollingInterval' => $summary->pollingInterval,
|
|
];
|
|
}
|
|
} |