yudhatp / laravel-activity-logs

Simple & Usefull Activity Log for Laravel

Home Page:https://packagist.org/packages/yudhatp/laravel-activity-logs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Laravel Activity Logs

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.

About

Simple & Usefull Activity Log for Laravel

https://packagist.org/packages/yudhatp/laravel-activity-logs

License:MIT License


Languages

Language:PHP 100.0%