Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

Is the event fired after?, because if it is, you can't uso 'echo' I think. If before event doesn't work either, try to not depend on events (on this one) and use a function call instead.

Last updated 2 years ago.
0

After some more tries/tests i did it by overwriting the save method. I still don't know what's wrong with the code from my first post it it works now. Thank you!

Last updated 2 years ago.
0

does "boot function called" appears?

try replacing static::saving with self::saving

Last updated 2 years ago.
0

Laravel hooks listen for a true/false response to be returned from them. Try:

static::saving(function($model)
{
    if (Sentry::check())
    {
         $model->user_id = Sentry::getUser()->getId();
         return true;
    } 
    return false;
});

Good luck :)

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

dustije dustije Joined 13 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.