lundi 1 octobre 2018

Laravel model event won't fire after ajax call

I'm using ajax to update my model User, the ajax part works fine since the data is updated successfully in the database, inside my controller action the update performed by :

$user->update($data);

The part that doesn't work:

I've used boots method updated inside my model like :

class User extends BaseModel
{
    ...

    public static function boot()
    {
        parent::boot();

        static::updated(function($model){
            Log::info("updated");
            dd($model);
        });
    }
}

The event was never reached I'm not sure why.

Problem: I'm trying to perform an action after the model update but the event doesn't fire.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire