2017 © Pedro Peláez
 

library eloquent-auditing

An eloquent package for recording model events to a database

image

mintbridge/eloquent-auditing

An eloquent package for recording model events to a database

  • Sunday, January 15, 2017
  • by mintbridge
  • Repository
  • 1 Watchers
  • 3 Stars
  • 1,389 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 6 % Grown

The README.md

Eloquent Auditing

This Laravel 5 package allows model events to be logged to a database. It provides a trait that can be added to any Eloquent model allowing for chosen events to be logged using a polymorphic relationship., (*1)

Installation

This package can be installed through Composer., (*2)

composer require mintbridge/eloquent-auditing

Once installed add the service provider and facade to your app config, (*3)

// config/app.php

'providers' => [
    '...',
    Mintbridge\EloquentAuditing\AuditServiceProvider::class,
];

'aliases' => [
    ...
    'Auditor' => Mintbridge\EloquentAuditing\AuditorFacade::class,
];

You'll also need to publish and run the migration in order to create the database table., (*4)

php artisan vendor:publish --provider="Mintbridge\EloquentAuditing\AuditServiceProvider" --tag="config"
php artisan vendor:publish --provider="Mintbridge\EloquentAuditing\AuditServiceProvider" --tag="migrations"
php artisan migrate

The configuration will be written to config/auditing.php. The options have sensible defaults but you should change the user to match the one used in your application., (*5)

Usage

This package will record the events from your models. To do so your model must use the Auditable trait and implement AuditableInterface., (*6)

use Mintbridge\EloquentAuditing\Auditable;
use Mintbridge\EloquentAuditing\AuditableInterface;

class Article extends Eloquent implements AuditableInterface {

    use Auditable;
...

The trait by default will use the event in config/auditing.php but you can overide this on a per model basis by adding a static $auditableEvents array of event names to the model. See http://laravel.com/docs/5.1/eloquent#events for the available events., (*7)

use Mintbridge\EloquentAuditing\Auditable;
use Mintbridge\EloquentAuditing\AuditableInterface;

class Article extends Eloquent implements AuditableInterface {

    use Auditable;

    public static $auditableEvents = [
        'creating',
        'created',
        'updating',
        //...
    ];
...

Contributing

Please see CONTRIBUTING for details., (*8)

License

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

The Versions

15/01 2017

dev-master

9999999-dev

An eloquent package for recording model events to a database

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

laravel eloquent audit auditing

15/01 2017

v0.0.5

0.0.5.0

An eloquent package for recording model events to a database

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

laravel eloquent audit auditing

08/01 2016

v0.0.4

0.0.4.0

An eloquent package for recording model events to a database

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

laravel eloquent audit auditing

06/12 2015

v0.0.3

0.0.3.0

An eloquent package for recording model events to a database

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

laravel eloquent audit auditing

06/12 2015

v0.0.2

0.0.2.0

An eloquent package for recording model events to a database

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

laravel eloquent audit auditing

06/12 2015

v0.0.1

0.0.1.0

An eloquent package for recording model events to a database

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

laravel eloquent audit auditing