Support for $deleteWhenMissingModels = true;
in queued listeners, mailables and notifications
#57397
Unanswered
turanjanin
asked this question in
Ideas
Replies: 1 comment 3 replies
-
You can also handle this like we do, by not letting the framework retrieve the model behind the scenes and handle the not found error. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In job classes, we can add a new property
private bool $deleteWhenMissingModels = true;
that will instruct Laravel to automatically delete the job if ModelNotFoundException gets thrown during the deserialization process. If this property is not present, the job will be marked as failed if some of the models get deleted before the job is processed.It would be good to have the same behavior in queued listeners, mailables, and notifications. Right now, the following listener will fail and end up in
failed_jobs
table if$file
gets deleted in the meantime.I know that the workaround is to have a synchronous listener that will dispatch the queued job, but it would be better if we could skip these extra steps.
Beta Was this translation helpful? Give feedback.
All reactions