Package Data | |
---|---|
Maintainer Username: | enginkartal |
Maintainer Contact: | admin@yellow.com.tr (Engin Kartal) |
Package Create Date: | 2016-08-22 |
Package Last Update: | 2016-11-16 |
Home Page: | https://yellowpages.com.tr |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-01-21 03:01:35 |
Package Statistics | |
---|---|
Total Downloads: | 85 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Nice and easy way to handle revisions of your MongoDB.
*Lumen5 + MongoDB revisions *Support Document Model
composer.json
: "require": {
// for Lumen5+ use:
"dataworkstr/revisionable": "~1.0",
...
},
app/config/app.php
: 'providers' => array(
...
'Sofa\Revisionable\Laravel\ServiceProvider',
),
~$ php artisan vendor:publish [--provider="Sofa\Revisionable\Laravel\ServiceProvider"]
this will create config/sofa_revisionable.php
file, where you can adjust a few settings:
<?php
return [
/*
|--------------------------------------------------------------------------
| User provider (auth) implementation.
|--------------------------------------------------------------------------
|
| By default Laravel generic Illuminate\Auth\Guard.
|
| Supported options:
| - illuminate
| - sentry
| - sentinel
| - jwt-auth
*/
'userprovider' => 'illuminate',
/*
|--------------------------------------------------------------------------
| User field to be saved as the author of tracked action.
|--------------------------------------------------------------------------
|
| By default:
|
| - id for illuminate
| - login field (email) for sentry/sentinel
| - id or ANY field in User model for tymon/jwt-auth
*/
'userfield' => null,
/*
|--------------------------------------------------------------------------
| Table used for the revisions.
|--------------------------------------------------------------------------
*/
'table' => 'revisions',
/*
|--------------------------------------------------------------------------
| Table max revision count / default=10
|--------------------------------------------------------------------------
*/
'options' => [
'max_revision'=>10
],
];
~$ php artisan migrate [--database=custom_connection]
You can provide additional --database
param if you want the migration to be run using non-default db connection.
<?php namespace App;
use Sofa\Revisionable\Laravel\RevisionableTrait; // trait
use Sofa\Revisionable\Revisionable; // interface
class User extends \Eloquent implements Revisionable {
use RevisionableTrait;
/*
* Set revisionable whitelist - only changes to any
* of these fields will be tracked during updates.
*/
protected $revisionable = [
'email',
'name',
'phonenumber.main_phone.0'
];