diff --git a/app/Filament/Widgets/Analytics.php b/app/Filament/Widgets/Analytics.php new file mode 100644 index 000000000..d8fa0722b --- /dev/null +++ b/app/Filament/Widgets/Analytics.php @@ -0,0 +1,40 @@ + + */ + protected int | string | array $columnSpan = 'full'; + + /** + * The table that will be displayed in the widget. + */ + public function table(Table $table): Table + { + $panAnalytics = new class extends Model + { + protected $table = 'pan_analytics'; + }; + + return $table + ->query( + $panAnalytics::query() + ) + ->columns([ + Tables\Columns\TextColumn::make('name'), + Tables\Columns\TextColumn::make('impressions'), + Tables\Columns\TextColumn::make('hovers'), + Tables\Columns\TextColumn::make('clicks'), + ]); + } +} diff --git a/app/Providers/Filament/CitadelPanelProvider.php b/app/Providers/Filament/CitadelPanelProvider.php index 41a15929f..9c6091be0 100644 --- a/app/Providers/Filament/CitadelPanelProvider.php +++ b/app/Providers/Filament/CitadelPanelProvider.php @@ -8,6 +8,7 @@ use Filament\Http\Middleware\DisableBladeIconComponents; use Filament\Http\Middleware\DispatchServingFilamentEvent; use Filament\Navigation\MenuItem; +use Filament\Pages\Dashboard; use Filament\Panel; use Filament\PanelProvider; use Filament\Support\Colors\Color; @@ -33,6 +34,9 @@ public function panel(Panel $panel): Panel ->path('citadel') ->homeUrl(fn (): string => route('home.feed')) ->spa() + ->pages([ + Dashboard::class, + ]) ->favicon(asset('/img/ico.svg')) ->brandLogo(asset('/img/logo-text.svg')) ->brandLogoHeight('1.85rem') diff --git a/tests/Http/Citadel/DashboardTest.php b/tests/Http/Citadel/DashboardTest.php new file mode 100644 index 000000000..b30361367 --- /dev/null +++ b/tests/Http/Citadel/DashboardTest.php @@ -0,0 +1,15 @@ +actingAs(User::factory()->create([ + 'email' => 'enunomaduro@gmail.com', + ])) + ->get('citadel/') + ->assertSeeLivewire(Analytics::class) + ->assertStatus(200); +}); diff --git a/tests/Unit/Citadel/Widgets/AnalyticsTest.php b/tests/Unit/Citadel/Widgets/AnalyticsTest.php new file mode 100644 index 000000000..229435735 --- /dev/null +++ b/tests/Unit/Citadel/Widgets/AnalyticsTest.php @@ -0,0 +1,10 @@ +assertSee('Analytics'); +});