Laravel User Logs

Laravel User Logs

Latest Stable Version Total Downloads License
View Package

laravel user logs

LaravelUserLogs simplifies user activity logging in Laravel applications by automatically storing logs when a model is created, updated, or deleted. With seamless integration and a customizable log viewer, developers can monitor user actions effectively.

Installation:

Install the package via Composer:

composer require dipesh79/laravel-user-logs

Usage:

  1. Publish Vendor File For Migration:
php artisan vendor:publish

And publish Dipesh79\LaravelUserLogs\LaravelLogServiceProvider.

  1. Run Migration:
php artisan migrate

  1. Model:

Use the HasLog trait in your model:

<?php

namespace App\Models;

use Dipesh79\LaravelUserLogs\Traits\HasLog;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    use HasLog;

Automated Static Events for Logs:

The Created, Updated, Deleted events are fired when a model is created, updated, or deleted, respectively. This package automatically stores the logs in the database.

Access User Logs:

<?php

$logs = \Dipesh79\LaravelUserLogs\Models\Log::get();

Updates:

  • V 1.4 update: View User Logs with a log viewer.
  • V 1.4.1 update: Configuration file for customizing log viewer settings.
  • V 1.5.0 update: Storage of updated values in the database and access to old and updated values in the model.

License: MIT

Author: @Dipesh79

Support: For support, email dipeshkhanal79@gmail.com.

This post is licensed under CC BY 4.0 by the author.