tallesairan / activity-log
Activity Log for Backpack
Requires
- backpack/crud: ^5.3.13
- spatie/laravel-activitylog: ^4.7
Requires (Dev)
- orchestra/testbench: ~5|~6
- phpunit/phpunit: ~9.0
README
This package adds a web interface that shows the activity log for projects that use Backpack for Laravel. It relies on Spatie laravel-activitylog
package, if you need further information on how to use it, head to https://spatie.be/docs/laravel-activitylog/.
How does it all work? Well:
- when a change happens to an Eloquent model, the Spatie package will make a note of it in the database;
- this package adds a web interface, so the admin can see the changes (aka activity log);
Preview
Don't belive how simple it is to use? Go ahead, try it right now, in our online demo. Edit some other entities, and check the activity logs page to see the changes.
Installation
Before official release, you need to add this to your
composer.json
'srepositories
section before you can install it, because the package hasn't been submitted to Packagist yet. This step should be removed before official release.
{
"type": "vcs",
"url": "git@github.com:Laravel-Backpack/activity-log.git"
}
In your Laravel + Backpack project:
# install the package composer require backpack/activity-log # publish and run the migrations php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="activitylog-migrations" php artisan migrate # optional: publish the config file php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="activitylog-config" # optional: add a sidebar entry item for the Activity Logs page php artisan backpack:add-sidebar-content "<li class='nav-item'><a class='nav-link' href='{{ backpack_url('activity-log') }}'><i class='nav-icon la la-stream'></i> Activity Logs</a></li>"
Usage
Inside all the Models you want to be logged, add the usage of the LogsActivity
Trait:
<?php namespace App\Models; use Backpack\CRUD\app\Models\Traits\CrudTrait; +use Backpack\ActivityLog\Traits\LogsActivity; class Article extends Model { use CrudTrait; + use LogsActivity; ...
Customization
TODO: questions to answer:
- What gets logged by default?
- How do you customize what gets logged?
- How do you customize the interface, if needed?
Security
If you discover any security related issues, please email cristian.tabacitu@backpackforlaravel.com instead of using the issue tracker.
Credits
License
This project was released under EULA, so you can install it on top of any Backpack & Laravel project. Please see the license file for more information.