Files
fotospiel-app/app/Filament/Widgets/PlatformStatsWidget.php
Codex Agent fa33e7cbcf Fix Event & EventType resource issues and apply formatting
- Fix EventType deletion error handling (constraint violations)
- Fix Event update error (package_id column missing)
- Fix Event Type dropdown options (JSON display issue)
- Fix EventPackagesRelationManager query error
- Add missing translations for deletion errors
- Apply Pint formatting
2026-01-21 10:34:06 +01:00

32 lines
955 B
PHP

<?php
namespace App\Filament\Widgets;
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
use Filament\Widgets\StatsOverviewWidget\Stat;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
class PlatformStatsWidget extends BaseWidget
{
protected ?string $pollingInterval = '30s';
protected function getStats(): array
{
$now = Carbon::now();
$dayAgo = $now->copy()->subDay();
$tenants = (int) DB::table('tenants')->count();
$events = (int) DB::table('events')->count();
$photos = (int) DB::table('photos')->count();
$photos24h = (int) DB::table('photos')->where('created_at', '>=', $dayAgo)->count();
return [
Stat::make('Tenants', number_format($tenants)),
Stat::make('Events', number_format($events)),
Stat::make('Photos', number_format($photos))
->description("+{$photos24h} in last 24h"),
];
}
}