mardi 31 juillet 2018

No query results for model at boot created event

I have a model with boot function which has created event like below.

However, I sometimes (not all the time) get No query results for model on ProcessAddressRefine which is a job. As far as I understand, created event should happen after record is created, so there is no way that there is no query result unless it gets deleted right after it has been created. I also wonder that looking at the DB record, ProcessAddressRefine job is properly executed.

What would be the problem in this case?

Any advice or suggestion would be appreciated. Thank you.

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

    self::created(function ($model) {
        if (!$model->lat || !$model->lng) {
            ProcessAddressRefine::dispatch($model);
        }
    });
}



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2mVyOEm
via IFTTT

Aucun commentaire:

Enregistrer un commentaire