conditionally render widget stat?
How can I show hide stat using a condition? I want to show the first stat only when $this->productCount > 0.
protected function getStats(): array
{
return [
Stat::make('Processed', '192.1k')
->color('success')
->extraAttributes([
'class' => 'cursor-pointer',
'wire:click' => "\$dispatch('setStatusFilter', { filter: 'processed' })",
]),
Stat::make('Product Count', $this->productCount)
->chart([7, 2, 10, 3, 15, 4, 17])
->description('Current product count')
->icon('heroicon-m-banknotes')
->color('success'),
];
} protected function getStats(): array
{
return [
Stat::make('Processed', '192.1k')
->color('success')
->extraAttributes([
'class' => 'cursor-pointer',
'wire:click' => "\$dispatch('setStatusFilter', { filter: 'processed' })",
]),
Stat::make('Product Count', $this->productCount)
->chart([7, 2, 10, 3, 15, 4, 17])
->description('Current product count')
->icon('heroicon-m-banknotes')
->color('success'),
];
}