jeudi 27 juillet 2017

Laravel - How to delete a job (Notification)

In my application an user can schedule a message (like a reminder) and when is the time, a popup appear on the application. For this, i've created a Notification and i send this through Websocket.

Now, suppose the use has insert a wrong date (or simply, want to change the remind date), i need to access the JOB before this is executed.

I did tried many solution, but no works...

My Notification class is:

class RemindNote extends Notification implements ShouldQueue, ShouldBroadcast
{
    use Queueable;
    use InteractsWithQueue;
}

Tried handle method on RemindNote:

public function handle($event) {
   $this->delete();
}

Having php artisan queue:work activated, when i schedule the notification, the handle method is never called.

Tried Queue::before on AppServiceProvider

This method is called but if i call $event->job->delete(), the notification is always fired - job deleted. But, if for example i call $event->job->release(), the job is re-scheduled

So, there is a way to access JOB payload and delete it BEFORE it is executed?



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

Aucun commentaire:

Enregistrer un commentaire