2017 © Pedro Peláez
 

library modelhistory

Provides tracking of Laravel Models for creating, updating and deleting events

image

rukhsar/modelhistory

Provides tracking of Laravel Models for creating, updating and deleting events

  • Friday, November 25, 2016
  • by Rukhsar
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Laravel Eloquent Model History

Provides tracking of Laravel Models for creating, updating and deleting events. When a model which use ModelHistory trait call created/updated/deleted, an entry is written to the database with which user updated the model and some information about model changes., (*1)

Installation

Run the follwoing command, (*2)

composer require rukhsar/modelhistory

Next, add the service provider in your array in config/app.php :, (*3)


'providers' => [ ... Rukhsar\ModelHistoryServiceProvider::class, ... ],

Publish the database migration, (*4)

php artisan vendor:publish --provider="Rukhsar\ModelHistoryServiceProvider"

and run, (*5)

php artisan migration

This will setup a model_history table in your database., (*6)

Use it

In you model, just add, (*7)

use Rukhsar\Traits\ModelHistory;

and within you class defination use it like below, (*8)

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Rukhsar\Traits\ModelHistory;

class Post extends Model
{
    use ModelHistory;


}

Get the history of a particular model

For example for abouve model you can get the history by using, (*9)

$post->history;

The Versions

25/11 2016

v1.0

1.0.0.0

Provides tracking of Laravel Models for creating, updating and deleting events

  Sources   Download

MIT

The Requires

 

by Rukhsar Manzoor

25/11 2016

dev-master

9999999-dev

Provides tracking of Laravel Models for creating, updating and deleting events

  Sources   Download

MIT

The Requires

 

by Rukhsar Manzoor