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"
In config/bootstrap.php
add:
Plugin::load('CakeSimpleModelHistory', ['bootstrap' => false, 'routes' => true]);
or using CakePHP's console:
./bin/cake plugin load CakeSimpleModelHistory
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');
}