adrolli / filament-spatie-laravel-activitylog
View your activity logs inside of Filament.
Fund package maintenance!
alexjustesen
Requires
- php: ^8.0 || ^8.1 || ^8.2
- filament/filament: ^3.0
- illuminate/contracts: ^8.0 || ^9.0 || ^10.0
- spatie/laravel-activitylog: ^4.3
- spatie/laravel-package-tools: ^1.9.2
Requires (Dev)
- nunomaduro/collision: ^5.10 || ^6.0
- nunomaduro/larastan: ^1.0 || ^2.0.1
- orchestra/testbench: ^6.22 || ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2024-10-27 02:44:12 UTC
README
This package provides a Filament resource that shows you all of the activity logs created using the spatie/laravel-activitylog
package. It also provides a relationship manager for related models.
Installation
You can install the package via composer:
composer require alexjustesen/filament-spatie-laravel-activitylog
You can publish the config file with:
php artisan vendor:publish --tag="filament-spatie-activitylog-config"
This is the contents of the published config file:
return [ 'resource' => [ 'filament-resource' => AlexJustesen\FilamentSpatieLaravelActivitylog\Resources\ActivityResource::class, 'group' => null, 'sort' => null, ], 'paginate' => [5, 10, 25, 50], ];
Usage
This package will automatically register the ActivityResource
class specified in the configuration resource.filament-resource
. You'll be able to see it when you visit your Filament admin panel.
Customising the ActivityResource
You can swap out the ActivityResource
used by publishing the configuration file and updating the resource.filament-resource
value. Use this to create your own ActivityResource
class and extend the original at AlexJustesen\FilamentSpatieLaravelActivitylog\Resources\ActivityResource::class
. This will allow you to customise everything such as the views, table, form and permissions. If you wish to change the resource on List and View page be sure to replace the getPages
method on the new resource and create your own version of the ListPage
and ViewPage
classes to reference the custom ActivityResource
.
Customising the group
You can customise the navigation group for the ActivityResource
by publishing the configuration file and updating the resource.group
value.
Customising the sorting
You can customise the navigation group for the ActivityResource
by publishing the configuration file and updating the resource.sort
value.
Relationship manager
If you have a model that uses the Spatie\Activitylog\Traits\LogsActivity
trait, you can add the AlexJustesen\FilamentSpatieLaravelActivitylog\RelationManagers\ActivitiesRelationManager
relationship manager to your Filament resource to display all of the activity logs that are performed on your model.
Show the subject
column on custom relation managers
When using the relationship manager the subject
column isn't shown because the subject is the parent record. There are some cases (like when aggregating activities from child records) where the subject might be another record, and you want to show this column. In those cases you can add the next code to your relation manager:
public function hideSubjectColumn(): bool { return false; }
Testing
composer test
Changelog
Please see RELEASES for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Alex Justesen
- Ryan Chandler (Original creator)
- All Contributors
License
The MIT License (MIT). Please see License File for more information.