class ReportingPage extends Dashboard
{
use HasFiltersForm;
// Configuration, setup, filtersForm …
public function content(Schema $schema): Schema
{
// Tab::class is an StringBackedEnum&HasLabel.
$tabsSchema = collect(Tab::cases())->map(
fn (Tab $tab) => Tabs\Tab::make($tab->getLabel())
->key($tab->value)
->schema([
Grid::make($this->getColumns())
->schema(fn (): array => $this->getWidgetsSchemaComponents(
widgets: match ($tab->value) {
'overview' => $this->getOverviewWidgets(),
'ratios' => $this->getRatioWidgets(),
'revenue' => $this->getRevenueWidgets(),
'customer-meetings' => $this->getCustomerMeetingsWidgets(),
}
)),
]));
return $schema
->components([
$this->getFiltersFormContentComponent(),
Tabs::make('Tabs')
->persistTabInQueryString()
->contained(false)
->schema($tabsSchema->toArray()),
]);
}
class ReportingPage extends Dashboard
{
use HasFiltersForm;
// Configuration, setup, filtersForm …
public function content(Schema $schema): Schema
{
// Tab::class is an StringBackedEnum&HasLabel.
$tabsSchema = collect(Tab::cases())->map(
fn (Tab $tab) => Tabs\Tab::make($tab->getLabel())
->key($tab->value)
->schema([
Grid::make($this->getColumns())
->schema(fn (): array => $this->getWidgetsSchemaComponents(
widgets: match ($tab->value) {
'overview' => $this->getOverviewWidgets(),
'ratios' => $this->getRatioWidgets(),
'revenue' => $this->getRevenueWidgets(),
'customer-meetings' => $this->getCustomerMeetingsWidgets(),
}
)),
]));
return $schema
->components([
$this->getFiltersFormContentComponent(),
Tabs::make('Tabs')
->persistTabInQueryString()
->contained(false)
->schema($tabsSchema->toArray()),
]);
}