- How do I install filament-logger in a Laravel application?
- Install the package with Composer using composer require riodwanto/filament-logger. Then publish and run the package migrations so the activity log table exists in your database, and publish the config file if you need to adjust defaults. Finally, register the plugin in your Filament panel provider so the log resource appears in the admin navigation. Clear your cached config after publishing to make sure the new settings are picked up.
- Which Laravel and Filament versions does filament-logger support?
- The package is built for modern Filament admin panels and current Laravel releases, so it expects a recent PHP version and a Laravel app that already has Filament installed and configured. Because supported versions change over time, always check the require section of the package composer.json before upgrading your app. If you are on an older Filament major version, verify compatibility first or pin the package version that matches your panel.
- What exactly does filament-logger record?
- It records activity log entries for user actions and model changes, then exposes them through a Filament resource so admins can review the audit trail without leaving the panel. Because it builds on Laravel activity logging, each entry typically captures the event name, the causer (usually the authenticated user), the subject model, and any properties you attach. This gives you a searchable history of who created, updated, or deleted records in your application.
- How do I register the logger plugin in my Filament panel provider?
- Open the panel provider that defines your Filament panel and add the package plugin to the plugin() chain on the panel configuration. Once registered, the logger resource is automatically discovered and added to the panel navigation. If you use multiple panels, register the plugin only in the panels where administrators should see the audit trail.
- Can I filter and search the activity logs in the Filament resource?
- Yes, the bundled resource provides a table of log entries with filtering and searching so you can narrow down by event type, causer, subject, or date range. This makes it practical to investigate a specific incident, such as who changed a record last week, without writing SQL queries. You can also extend the resource's table definition to add your own filters or columns.
- How do I log custom activities that are not model events?
- Since the package is powered by Laravel activity logging, you can record custom events using the standard activity helper or the underlying logger class from your own code. Attach a causer with causedBy(), a subject with performedOn(), and any contextual data with withProperties() so the entry is useful in the Filament review table. Custom activities then appear alongside automatic model change logs in the same resource.
- Will filament-logger slow down my production application?
- Logging writes one row per recorded activity, so the main production concern is table growth rather than request overhead. Add indexes on the causer and subject columns, and schedule regular pruning of old entries using the pruning options provided by the underlying activity log package. For high-traffic apps, consider logging only the events you actually audit instead of every model event.
- How do I test that activity logging works in my application?
- Use Laravel's testing helpers with RefreshDatabase, authenticate a user with actingAs(), perform the action you want to audit, and then assert that the expected row exists in the activity log table. Asserting on the event name, causer id, and subject keeps the test resilient to changes in unrelated columns. You can also write a Filament resource test to confirm the log entries are visible to authorized users.
- How do I restrict who can view the activity log resource?
- Access is controlled through Filament's usual authorization mechanisms, so you can gate the resource with a policy or by overriding the canViewAny and canView methods. This lets you keep audit data visible to administrators while hiding it from regular panel users. You can also limit which panels register the plugin to keep the resource out of customer-facing panels entirely.
- What are the alternatives to filament-logger?
- The most common alternative is using spatie/laravel-activitylog directly and building your own Filament resource on top of it, which gives maximum control but more work. Other Filament activity log plugins and generic audit trail packages also exist, and some teams simply log to an external service. Filament Logger is a good fit when you want an out-of-the-box Filament resource with filtering and minimal setup.