Dynamically Adding Jobs to a Chain Within an Existing Laravel Batch at Runtime #54775
Unanswered
ManukMinasyan
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm working with Laravel's job batching system and need to dynamically add jobs to a chain within an existing batch during runtime. Specifically, I want to prepend or append jobs to the current job's chain and ensure they're correctly associated with the batch, with the batch's total job count updated accordingly.
To achieve this, I created a
BatchChainable
trait that extends Laravel'sBatchable
trait, adding methods to prepend or append jobs to the batch chain and update the total job count.Here's the
BatchChainable
:Usage Example:
Beta Was this translation helpful? Give feedback.
All reactions