rtconner / laravel-tagging

Tag support for Laravel Eloquent models - Taggable Trait
MIT License
882 stars 168 forks source link

Error on Adding User's tags #100

Closed cobisja closed 8 years ago

cobisja commented 8 years ago

Hi,

First of all, thanks for this amazing package.

I've been using the package with no problem but when I decided to make Laravel's User model into taggable using the Taggable trait, I have an error when I try to add a tag for a user instance:

$user = User::first(); $user->tag('vip');

The last sentence above throws the following error:

Call to a member function makeTagArray() on null

I cannot understand why this error is happening. Others models I'm using with taggable trait work as expected.

Could you tell me what I'm doing wrong?

cobisja commented 8 years ago

Found the problem. My User model has defined a callback for created event through overridden boot method. The problem was I forgot to call parent boot method to Boot all of the bootable traits on the model.

Thanks again for your contribution.

rtconner commented 8 years ago

Lol OK good. I was as confused as you trying to figure out why that would happen.