1. Go to this page and download the library: Download sofa/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.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
return [
/*
|--------------------------------------------------------------------------
| User model (for executor relation on Revision model).
|--------------------------------------------------------------------------
|
| By default App\User.
*/'usermodel' => 'App\User',
/*
|--------------------------------------------------------------------------
| User provider (auth) implementation.
|--------------------------------------------------------------------------
|
| By default Laravel generic Illuminate\Auth\Guard.
|
| Supported options:
| - illuminate
| - sentry
| - sentinel
| - jwt-auth
| - session
*/'userprovider' => 'illuminate',
/*
|--------------------------------------------------------------------------
| User field to be saved as the author of tracked action.
|--------------------------------------------------------------------------
|
| By default:
|
| - id for illuminate
| - login field (email) for sentry/sentinel
*/'userfield' => 'id',
/*
|--------------------------------------------------------------------------
| Table used for the revisions.
|--------------------------------------------------------------------------
*/'table' => 'revisions',
/*
|--------------------------------------------------------------------------
| Database connection used for the revisions.
|--------------------------------------------------------------------------
*/'connection' => null,
];
namespaceApp;
useIlluminate\Database\Eloquent\Model;
useSofa\Revisionable\Laravel\Revisionable; // traitclassUserextendsModel{
useRevisionable;
/*
* Set revisionable whitelist - only changes to any
* of these fields will be tracked during updates.
*/protected $revisionable = [
'email',
'name',
];