1. Go to this page and download the library: Download ciyin/revisionable library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ciyin / revisionable example snippets
"ciyin/revisionable": "1.*",
namespace MyApp\Models;
class Article extends Eloquent {
use \Venturecraft\Revisionable\RevisionableTrait;
public static function boot()
{
parent::boot();
}
}
use Venturecraft\Revisionable\Revisionable;
namespace MyApp\Models;
class Article extends Revisionable { }
namespace MyApp\Models;
class Article extends Eloquent {
use Venturecraft\Revisionable\RevisionableTrait;
protected $revisionEnabled = false;
}
namespace MyApp\Models;
class Article extends Eloquent {
use Venturecraft\Revisionable\RevisionableTrait;
protected $revisionEnabled = true;
protected $historyLimit = 500; //Stop tracking revisions after 500 changes have been made.
}
namespace MyApp\Models;
class Article extends Eloquent {
use Venturecraft\Revisionable\RevisionableTrait;
protected $revisionEnabled = true;
protected $revisionCleanup = true; //Remove old revisions (works only when used with $historyLimit)
protected $historyLimit = 500; //Maintain a maximum of 500 changes at any point of time, while cleaning up old revisions.
}
// app/Providers/EventServiceProviders.php
public function boot(DispatcherContract $events)
{
parent::boot($events);
$events->listen('revisionable.*', function($model, $revisions) {
// Do something with the revisions or the changed model.
dd($model, $revisions);
});
}