ResourceViewed) to track activity, minimizing direct model/database changes.recently_viewed table (migration provided).config/recently.php).Widget) and resource actions (e.g., "View Recently") with minimal CSS overrides (theme-aware).config/recently.php).orderBy + limit, which could impact large datasets (test with DB::enableQueryLog).Post, User)?recently_viewed table is scoped/encrypted.RecentlyService and RecentlyViewed model?recently_viewed queries.spatie/activitylog (broader but heavier).composer require filament/filament:"^5.0").composer require awcodes/recently
php artisan recently:install
config/recently.php for:
models (whitelist/blacklist).max_items (default: 20).cache_driver (e.g., redis).\App\Models\Post::find(1)->view(); // Simulate a view
\RecentlyViewed::latest()->take(5)->get();
filament/spatie-laravel-medialibrary) if they don’t conflict on resource events.Post).awcodes/recently for Filament version support drops (e.g., if Filament 6.x is released).config/recently.php—easy to audit.RecentlyViewed::query()->toSql() to inspect queries.filament.log for event-related errors.config/recently.php without breaking core functionality.config/recently.max_items (e.g., 50).recently_viewed has indexes on model_type, model_id, and created_at.| Scenario | Impact | Mitigation |
|---|---|---|
| Database connection fail | Tracking stops; widget shows stale data | Implement retry logic in RecentlyService. |
| Cache failure (Redis) | Slower queries, no caching benefit | Fallback to DB with cache_driver: null. |
| Filament event conflict | Resource views not tracked | Check for duplicate event listeners. |
| CSS theme mismatch | Widget renders but looks broken | Extend Filament’s theme with custom CSS. |
RecentlyViewed model).How can I help you explore Laravel packages today?