2017 © Pedro Peláez
 

package time-traveller

Time travelling for Laravel models.

image

conceptbyte/time-traveller

Time travelling for Laravel models.

  • Monday, May 23, 2016
  • by rajdeeptarat
  • Repository
  • 3 Watchers
  • 37 Stars
  • 45 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 2 Open issues
  • 6 Versions
  • 2 % Grown

The README.md

Laravel Time Traveller

Time travelling for Laravel 5 models. - Uses database table to store model states. - Can be accessed from ORM or URL Query String. - Bundled command to keep revisions table healthy. - Ability to override Revisions model for extension., (*1)

Installation

Run the following command on your project root. composer require conceptbyte/time-traveller, (*2)

Add the service provider to the config/app.php file under the providers key. Make sure to add it after the default laravel service providers., (*3)

'providers' => [
    ...,
    'ConceptByte\TimeTraveller\TimeTravellerServiceProvider'
]

Publish Configuration

Run php artisan vendor:publish to publish the package configurations., (*4)

Modify Configuration

Use the config/timetraveller.php file to modify the package defaults. - Revisions Model 'model' => ConceptByte\TimeTraveller\Models\Revision::class - Query String Parameter 'at' => 'at' - Clear audits that are older than 'clear' => '365', (*5)

Usage

Enable time traveller on a model by using the trait., (*6)

class Post extents Model
{
    use TimeTravel;

    public function getBy()
    {
        return Auth::user()->name;
    }
}

All models that use the trait must implement abstract public function getBy() which returns any string. This function can be used to save any additional attributes such as the owner of the change., (*7)

Get the state of a record at a specific data/time.

Post::at('58781813')->find(1);

Get the state of a record using a query string.

URL: timetravel.app/posts/1?at=58781813, (*8)

Post::find(1);

Get a model with revisions

Post::with('revisions')->first();

You can clear the audits table records that are older than a specified range.

php artisan time-traveller:clear. This will read the config file and clear records that are older than the configured number of days., (*9)

The Versions

23/05 2016

dev-master

9999999-dev

Time travelling for Laravel models.

  Sources   Download

MIT

The Requires

 

23/05 2016

v1.0.1

1.0.1.0

Time travelling for Laravel models.

  Sources   Download

MIT

The Requires

 

23/05 2016

v1.0.0

1.0.0.0

Time travelling for Laravel models.

  Sources   Download

MIT

The Requires

 

07/05 2016

v0.1.2

0.1.2.0

Time travelling for Laravel models.

  Sources   Download

MIT

The Requires

 

20/02 2016

v0.1.1

0.1.1.0

Time travelling for Laravel models.

  Sources   Download

MIT

The Requires

 

19/09 2015

v0.1.0

0.1.0.0

Time travelling for Laravel models.

  Sources   Download

MIT

The Requires

  • php >=5.5.9