laravel-meta icon indicating copy to clipboard operation
laravel-meta copied to clipboard

Not working with model events

Open Himalayjp opened this issue 8 years ago • 3 comments

If you are using laravel events https://laravel.com/docs/5.2/eloquent#events with metable in model, While creating or updating the record model event is executing twice as metable is updating the record with metafield once the record has been saved using model eloquent..

Himalayjp avatar Oct 18 '16 08:10 Himalayjp

i get no update from the mete values :))) Now, when the updated event is called, my model has no meta fields filled.

Temepest74 avatar Sep 09 '21 13:09 Temepest74

Can you submit a PR?

kodeine avatar Sep 09 '21 14:09 kodeine

After a lot of debuging, I found out that my problem had something to do with laravel... Idk how but I found a workaround. My issue was: when I fire an event from the booted model function (static::saved) I will be able to assign the new value of the model to a global variable, but inside the broadcastWith function, I will not get the new value (but the old one). Idk what causes this, but if I dispatch my event with event::dispatch it works like a charm

Temepest74 avatar Sep 09 '21 15:09 Temepest74