andrewboy/historylog

Laravel package for Model history logging.
936 2
Install
composer require andrewboy/historylog
PHP:>=5.5.9
Last Updated:Oct 1, 2015
Links: GitHub  ·  Packagist
Maintainer: andrewboy

HistoryLog

This is a Laravel 5 package, that can log Model history.

It's under development, not recommended for production use!

Installation

add bundle to composer:

"andrewboy/historylog": "dev-master"

run composer:

composer install / update

add service provider to the providers list:

'Andrewboy\HistoryLog\HistoryLogServiceProvider'

publish config and migration:

php artisan vendor:publish --provider="Andrewboy\HistoryLog\HistoryLogServiceProvider"

run migration:

php artisan migrate

Usage

  1. You have to create a Trait that uses the "HistoryLog" trait and implement the "getUserId" abstract method.

use Andrewboy\HistoryLog\Traits\HistoryLogTrait;

trait MyHistoryLogTrait{

    use HistoryLogTrait;
    
    /**
     * Get the logged users' ID
     * @return integer | null On success user ID
     */
    public function getUserId()
    {
        ...
    }
}

  1. Simply just add the trait to your model

use App\Traits\MyHistoryLogTrait;

class MyModel extends Model
{

    use MyHistoryLogTrait;
    
}

Related Packages

panoscape/history

Eloquent model history tracking for Laravel

138,891 164
gabrieljaime/table_history_log

Keep a history for your models

9 0
digioperis/model-history

Provides an easy way to track changes to Laravel models

14 1
mpociot/versionable

Allows to create Laravel 4 / 5 / 6 / 7 / 8 / 9 / 10 / 11 Model versioning and re...

1,359,771 785