| Install | |
|---|---|
composer require adrolli/filament-spatie-laravel-activitylog |
|
| Latest Version: | v1.1 |
| PHP: | ^8.0 || ^8.1 || ^8.2 |
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.
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],
];
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.
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.
You can customise the navigation group for the ActivityResource by publishing the configuration file and updating the resource.group value.
You can customise the navigation group for the ActivityResource by publishing the configuration file and updating the resource.sort value.
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.
subject column on custom relation managersWhen 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;
}
composer test
Please see RELEASES for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.