1 year ago

Queue - "Updated" doesn't work

Posted 1 year ago by oliverbusk

In my model DocumentFieldContent, I have defined below events:

protected $dispatchesEvents = [
     'created' => DocumentFieldCreated::class, //Once document has been uploaded.
     'updated' => DocumentFieldUpdated::class, //One the document fields has been updated.

Now, when a new DocumentFieldContent is created in my database, the event is successfully fired, and the listener is picking up the event just fine.

However, the updated event does not work.

Let's say I update the field manually like:

    $update = DocumentFieldContent::find(1);
    $update->content = 'Updated Content';

The event App\Events\DocumentFieldUpdated is successfully fired, but the listener is not being "catched":

Name                                  Listeners 
App\Events\DocumentFieldUpdated       0 

I have mapped the necessary things within EventServiceProvider:

    protected $listen = [
        DocumentFieldCreated::class => [

        DocumentFieldUpdated::class => [

What I have tried:

I have tried to run below artisan commands:

composer dumpautoload
php artisan clear-compiled
php artisan queue:restart

But it still does not work when I update the resource.

My .env file looks like:


But nothing is added to my database either.

What am I doing wrong?

Please sign in or create an account to participate in this conversation.