siduko/laravel-activitylog

This laravel 5 package provides to log the activity of the users

dev-master / 1.0.x-dev 2016-10-25 08:32 UTC

This package is not auto-updated.

Last update: 2024-05-06 13:28:36 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

This laravel 5 package provides to log the activity of users. It can also automatically log model events, custom message log. You can custom log handler to saving another destination Unless you can use built in handler as EloquentHandler (using database ) or LogHandler (using log)

Install

Via Composer

$ composer require siduko/laravel-activitylog

Or add composer.json

"require": {
    '...',
    "siduko/laravel-activitylog":"v1.0-dev"
}

Usage

Install the service provider to config.php

// config/app.php

'providers' => [
    '...',
    \LaiVu\ActivityLog\ActivityLogServiceProvider::class,
],

'aliases' => [
    '...',
    'ActivityLog'=>\LaiVu\ActivityLog\ActivityLogFacade::class,
],

You can publish the migration with:

php artisan vendor:publish --provider="LaiVu\ActivityLog\ActivityLogServiceProvider" --tag="migrations"

After you run migration

php artisan migrate

You can optionally publish the config file with:

php artisan vendor:publish --provider="LaiVu\ActivityLog\ActivityLogServiceProvider" --tag="config"

Default config

<?php
/**
 * Created by PhpStorm.
 * User: Lai Vu
 * Date: 10/24/2016
 * Time: 3:52 PM
 */

return [
    /***
     * When set to true, activity log will be active
     */
    'enabled' => env('ACTIVITY_LOGGER_ENABLED', true),

    'activity_model' => '\LaiVu\ActivityLog\Models\Activity',

    'default_log_name' => 'default',

    /***
     * Default activity log handle, using to setting log handler
     * You can custom a handler and set to here
     *  Example:
     *   'default' => ['eloquent','log','custom']
     */
    'default' => ['eloquent'],

    /**
     * When set to true, the subject returns soft deleted models.
     */
    'subject_returns_soft_deleted_models' => false,

    'delete_records_older_than_days' => 365,

    /***
     * List log handlers, you can add new custom handler
     * `driver` is classpath of log handler
     */
    'handlers' => [
        'log' => [
            'driver' => '\LaiVu\ActivityLog\Handlers\LogHandler'
        ],
        'eloquent' => [
            'driver' => '\LaiVu\ActivityLog\Handlers\EloquentHandler'
        ]
    ]
];

Basic Usage

This is the most basic way to log activity:

activity()->log('Look mum, I logged something');

Or

ActivityLog::log('Look mum, I logged something');

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email laivu.fly@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.