[Filament v3] StatsOverview Widget Not Showing on Custom Dashboard Page
Hi everyone,
I'm currently working with Filament v3, and I'm trying to build a custom dashboard page that shows a StatsOverviewWidget. However, the widget does not appear on the page even though I believe I’ve registered everything correctly.
I generated the widget using the command, and choose admin panel
I'm currently working with Filament v3, and I'm trying to build a custom dashboard page that shows a StatsOverviewWidget. However, the widget does not appear on the page even though I believe I’ve registered everything correctly.
I generated the widget using the command, and choose admin panel
php artisan make:filament-widget StatsOverview --stats-overviewphp artisan make:filament-widget StatsOverview --stats-overview<?php
namespace App\Filament\Widgets;
use App\Models\User;
use App\Models\Booking;
use App\Models\Transaction;
use Filament\Widgets\StatsOverviewWidget\Stat;
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
class StatsOverview extends BaseWidget
{
protected function getStats(): array
{
return [
Stat::make('Total Users', User::count()),
Stat::make('Pending Booking Today', Booking::whereDate('created_at', today())->count()),
Stat::make('Transaction Created Today', Transaction::whereDate('created_at', today())->count()),
Stat::make('Unique views', '192.1k')
->description('32k increase')
->descriptionIcon('heroicon-m-arrow-trending-up')
->chart([7, 2, 10, 3, 15, 4, 17])
->color('success'),
];
}
}<?php
namespace App\Filament\Widgets;
use App\Models\User;
use App\Models\Booking;
use App\Models\Transaction;
use Filament\Widgets\StatsOverviewWidget\Stat;
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
class StatsOverview extends BaseWidget
{
protected function getStats(): array
{
return [
Stat::make('Total Users', User::count()),
Stat::make('Pending Booking Today', Booking::whereDate('created_at', today())->count()),
Stat::make('Transaction Created Today', Transaction::whereDate('created_at', today())->count()),
Stat::make('Unique views', '192.1k')
->description('32k increase')
->descriptionIcon('heroicon-m-arrow-trending-up')
->chart([7, 2, 10, 3, 15, 4, 17])
->color('success'),
];
}
}<?php
namespace App\Filament\Pages;
use App\Filament\Widgets\AdminWidgets;
use Filament\Pages\Dashboard as BaseDashboard;
class DashboardAdmin extends BaseDashboard
{
protected static ?string $navigationIcon = 'heroicon-o-home';
protected ?string $heading = 'Analytics';
protected function getHeaderWidgets(): array
{
return [
AdminWidgets::class,
];
}
}<?php
namespace App\Filament\Pages;
use App\Filament\Widgets\AdminWidgets;
use Filament\Pages\Dashboard as BaseDashboard;
class DashboardAdmin extends BaseDashboard
{
protected static ?string $navigationIcon = 'heroicon-o-home';
protected ?string $heading = 'Analytics';
protected function getHeaderWidgets(): array
{
return [
AdminWidgets::class,
];
}
}