Pregunta

I am using laravel 4 and I want to keep track of history of all transactions made to a table. I followed those steps

  1. added "venturecraft/revisionable": "1.*" at composer.json
  2. php composer.phar update
  3. run in the root of my project this :

    php artisan migrate --package=venturecraft/revisionable

and it says "nothing to migrate"

then i copied the migration file from the package in my app/database folder, and changed the classname from CreateRevisionsTable to something like CreateRevisionTable and the table was created in my database. Then I added this in my Car model:

1.

 class Car extends Eloquent {
    use \Venturecraft\Revisionable\RevisionableTrait;

    protected $keepRevisionOf = array(
    'Description'
    );

}

Then in my controller:

 $description = Car::find($id);
        $history = $description->revisionHistory;

And then in my view:

 @foreach($history->revisionHistory as $h )
                <li>{{ $h->userResponsible()->username }} changed {{ $h->fieldName() }} from {{ $h->oldValue() }} to {{ $h->newValue() }}</li>
                @endforeach

composer.json

"require": {
        "laravel/framework": "4.1.*",
        "ajessup/gae-laravel": "dev-master",
                "venturecraft/revisionable": "1.*"
    },

And the result is:

Trait 'Venturecraft\Revisionable\RevisionableTrait' not found 

What am I missing?

¿Fue útil?

Solución

Try setting the item in composer to:

"venturecraft/revisionable": "~1.8"

This will match any version from 1.8 to but not including 2.0.

EDIT: This solution makes no difference.

EDIT: Maybe.

Otros consejos

Just run composer dumpautoload and it should work...

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top