chelout/laravel-relationship-events

Cannot instantiate trait Chelout\RelationshipEvents\Concerns\HasBelongsToManyEvents

Closed this issue · 3 comments

I using this code
protected $dispatchesEvents = [ 'belongsToManyAttached' => HasBelongsToManyEvents::class, ];

And it show exception.

Cannot instantiate trait Chelout\RelationshipEvents\Concerns\HasBelongsToManyEvents

Please help me solve it.

You've got an error in your code. You should assign your own event class like this:

protected $dispatchesEvents = [
    'belongsToManyAttached' => YourOwnEvent::class,
];

And one more thing, there is a bug with dispatchable events for now. I'll fix it as soon as i find proper way to do it, hope to manage it today.

Duplicate of #4

In order to fix the issue update to the latest release