mazba/cake-simple-model-history

There is no license information available for the latest version (dev-master) of this package.

CakeSimpleModelHistory plugin for CakePHP (mazba.github.io)

Installs: 37

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 2

Forks: 1

Open Issues: 0

Language:CSS

Type:cakephp-plugin

dev-master 2016-12-20 09:15 UTC

This package is not auto-updated.

Last update: 2024-05-20 11:30:02 UTC


README

Installation

You can install this plugin into your CakePHP application using composer.

Add the following lines to your application's composer.json:

    "require": {
       "mazba/cake-simple-model-history": "dev-master"
    }	

followed by the command: composer update

Or

The recommended way to install composer packages is:

    composer require "mazba/cake-simple-model-history:dev-master"	

Setup

In config/bootstrap.php add:

    Plugin::load('CakeSimpleModelHistory', ['bootstrap' => false, 'routes' => true]);

or using CakePHP's console:

    ./bin/cake plugin load CakeSimpleModelHistory

Configuration

Add the following line to your AppController:

    use CakeSimpleModelHistory\Controller\ActivityLogsTrait;

Add the following inside your AppController Class

    class AppController extends Controller
    {
        use ActivityLogsTrait;
    }

Finally, you'll also need to run migration on the package

    cake migrations migrate -p CakeSimpleModelHistory

Attach the behavior in the models you want with:

    public function initialize(array $config) {
        $this->addBehavior('CakeSimpleModelHistory.ActivityLogs');
    }

To view history : /cake-simple-model-history