feat: global overview widget, optimized cache, CSS asset docs

- Add ShortUrlGlobalOverview StatsOverviewWidget with split cache strategy:
  link counts cached forever (invalidated on create/delete), click stats
  with short TTL (geo_ip.stats_cache_ttl config)
- Fix visited_at column in ShortUrlVisit queries (was created_at)
- Disable Livewire polling (pollingInterval = null)
- Add cache invalidation for global overview in ShortUrl::booted()
- Rewrite README asset section: user-facing install instructions clarified,
  post-autoload-dump tip added, developer recompile notes separated
This commit is contained in:
Bartłomiej Janczak
2026-06-01 18:59:17 +02:00
parent f0d76ff03b
commit 65a1b126df
15 changed files with 944 additions and 146 deletions

View File

@@ -8,6 +8,9 @@ use Bjanczak\FilamentShortUrl\Services\ShortUrlService;
use Bjanczak\FilamentShortUrl\Services\ShortUrlSettingsManager;
use Bjanczak\FilamentShortUrl\Services\ShortUrlTracker;
use Bjanczak\FilamentShortUrl\Services\UserAgentParser;
use Filament\Support\Assets\Css;
use Filament\Support\Facades\FilamentAsset;
use Illuminate\Console\Scheduling\Schedule;
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;
@@ -47,4 +50,24 @@ class FilamentShortUrlServiceProvider extends PackageServiceProvider
$this->app->singleton(ShortUrlService::class);
$this->app->singleton(ShortUrlTracker::class);
}
public function packageBooted(): void
{
FilamentAsset::register([
Css::make('filament-short-url', __DIR__.'/../resources/dist/filament-short-url.css'),
], package: 'janczakb/filament-short-url');
// Automatically register scheduled tasks in the application scheduler
$this->app->booted(function (): void {
$schedule = $this->app->make(Schedule::class);
if (config('filament-short-url.pruning.enabled', true)) {
$schedule->command('short-url:aggregate-and-prune')->dailyAt('02:00');
}
if (config('filament-short-url.counter_buffering.enabled', false)) {
$schedule->command('short-url:sync-counters')->everyMinute();
}
});
}
}