Using `boot ()` in the model conflicts with the RevisionableTrait

I am using Revisionable package in my laravel app to write changes to model.

In addition, I also applied an observer class to listen for certain model events (update, delete, create, etc.) and perform actions (such as clear caches, etc.). This observer is created in the model using the method boot()

as follows:

class Client {
    use \Venturecraft\Revisionable\RevisionableTrait;
    public static function boot()
    {
        parent::boot();
        Client::observe(new App\Observers\ClientObserver);
    }
}

      

I found that when I define a method boot()

in my model, the Revisionable Trait stops working and does not register the changes - presumably because it also uses a method boot

that is overridden by the one in the model.

How can I fix this to listen for model events and also use the Revisionable package?

+3


source to share


1 answer


this link helped me

https://github.com/VentureCraft/revisionable/issues/175



I used in laravel 5.1, hope it works with you.

use RevisionableTrait, UuidTrait {
        UuidTrait::boot insteadof RevisionableTrait;
    }

      

0


source







All Articles