yudhatp / laravel-activity-logs
Simple Activity Log for Laravel
0.0.3
2023-10-11 02:12 UTC
Requires
- php: ^7.3|^8.0
- laravel/framework: ^6.0|^7.0|^8.0|^9.0|^10.0
Requires (Dev)
- phpunit/phpunit: ^9.3
- symfony/var-dumper: ^5.0
README
Simple & Usefull Activity Log for Laravel 6.x, 7.x, 8.x, 9.x, 10,x.
Installation
You can install the package via composer:
composer require yudhatp/laravel-activity-logs
You can publish and run the migrations with:
php artisan migrate
You can publish config file with:
php artisan vendor:publish --tag=yudhatp-activity-logs-config
Usage
Auto Logging
on "kernel.php", add this line on your "protected $middlewareGroups"
'web' => [ ... \Yudhatp\ActivityLogs\Middleware\ActivityLogMiddleware::class, ... ],
in the config file, you can determine what data will be stored in "user_id". at default, the data that will be stored is the "id" field but you can manually change this at "user" data. for example :
'user' => 'employee_id'
Manual Logging
on your controller, write this code :
use Yudhatp\ActivityLogs\ActivityLogs; ActivityLogs::log(auth()->user()->id, $request->ip(), 'Profile', 'View/Edit Profile');
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.