mortezamasumi / fb-activity
Filament v5 activity log resource with exports, filters, and Shield integration
Requires
- php: ^8.3
- filament/filament: ^5.0
- mortezamasumi/fb-essentials: ^5.1.1
- spatie/laravel-activitylog: ^4.0
- spatie/laravel-package-tools: ^1.0
Requires (Dev)
- filament/upgrade: ^5.0
- larastan/larastan: ^3.10
- laravel/pint: ^1.30
- orchestra/testbench: ^10.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-browser: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- pestphp/pest-plugin-livewire: ^4.0
- phpstan/phpstan: ^2.2
This package is auto-updated.
Last update: 2026-07-31 13:23:56 UTC
README
A Filament v5 plugin that surfaces spatie/laravel-activitylog records as a read-only admin resource: searchable, filterable table with CSV export, an infolist view page, Persian date handling, and Filament Shield permission integration.
Features
- Activity resource — index and view pages backed by the
activity_logtable, with eager-loaded causer/subject relationships - CSV export — Filament export action with a configurable max row limit and completion notifications
- Table & filters — searchable/sortable columns, a
created_atdate-range filter, and causer search acrossname/first_name/last_name - View page — infolist with human-readable subject names and a rendered
propertiessection - Log scoping — include/exclude activity descriptions by wildcard pattern via config or env
- Permissions —
ViewAny:Activity,View:Activity,Delete:Activity,Export:Activity,ViewAllUsers:Activitywired through Filament Shield - Localized UI — Persian and English translations shipped out of the box
Installation
composer require mortezamasumi/fb-activity
Publish and run the migration:
php artisan vendor:publish --tag="fb-activity-migrations"
php artisan migrate
Publish the config file:
php artisan vendor:publish --tag="fb-activity-config"
Configuration
// config/fb-activity.php return [ 'navigation' => [ 'model_label' => 'fb-activity::fb-activity.navigation.label', 'plural_model_label' => 'fb-activity::fb-activity.navigation.plural_label', 'group' => 'fb-activity::fb-activity.navigation.group', 'parent_item' => null, 'icon' => 'heroicon-o-queue-list', 'active_icon' => 'heroicon-s-queue-list', 'badge' => false, 'badge_tooltip' => null, 'sort' => 20, ], 'export' => [ 'exporter' => '\Mortezamasumi\FbActivity\Resources\Exports\ActivityExporter', 'max_export_rows' => env('ACTIVITY_MAX_EXPORT_ROWS', 3000), ], 'exclude_logs' => env('ACTIVITY_EXCLUDE_LOGS', null), 'include_logs' => env('ACTIVITY_INCLUDE_LOGS', null), ];
navigation.*— panel navigation label, group, icons, badge, and sort orderexport.max_export_rows— maximum rows per export (default3000)exclude_logs/include_logs— comma-separated description patterns;*matches any characters and?matches a single character. Include patterns apply asOR(any match is kept), exclude patterns apply asNOT LIKEon top of the include filter
Usage
Register the plugin in a panel
use Mortezamasumi\FbActivity\FbActivityPlugin; public function panel(Panel $panel): Panel { return $panel ->plugin(FbActivityPlugin::make()); }
Human-readable subject names
use Mortezamasumi\FbActivity\Facades\FbActivity; FbActivity::getSubjectName($record, $subjectType); // 'Podcast' from 'App\Models\Podcast' FbActivity::getSubject($record, $subjectType); // 'Podcast ↣ Episode 42' when the subject resolves
getSubject() resolves the activity's subject model by ID and displays its name, title, or
text attribute (in that order); it falls back to the raw subject_id when the class is unknown.
Permissions
Create the permissions with Filament Shield as Activity permissions and add the resource via
filamentShieldAddResource (done automatically by the service provider):
| Permission | Effect |
|---|---|
ViewAny:Activity |
view the resource index |
View:Activity |
view a single activity |
Delete:Activity |
bulk-delete activities |
Export:Activity |
export activities as CSV |
ViewAllUsers:Activity |
see activities by all users (otherwise only your own) |
Support policy
| PHP | Laravel | Filament |
|---|---|---|
| 8.3 | 12 | 5.x |
Testing
composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover a security vulnerability, please review our security policy on how to report it.
Changelog
Please see CHANGELOG for recent changes.
License
The MIT License (MIT). See LICENSE.md for details.