I think I've got it. Just need to confirm 100% and figure out the version but it seems that I'm on an older (minor/patch) version of the laravel/framework 8:
The following looks like it'll fix it:
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi,
According to the docs here: https://laravel.com/docs/8.x/queues#chains-within-batches
It should be possible to place multiple chains (as arrays) within the batch array.
My understanding of this is that the following should work:
// Some controller
$batch = Bus::batch([
[
new PrepareOutput($output_queue[0], $template),
new CreateOutput($output_queue[0]),
],
[
new PrepareOutput($output_queue[1], $template),
new CreateOutput($output_queue[1]),
],
])
->then(function (Batch $batch) {
// All jobs completed successfully...
})
->catch(function (Batch $batch, Throwable $e) {
// First batch job failure detected...
})
->finally(function (Batch $batch) {
// The batch has finished executing...
})
->dispatch();
return $batch->id;
However I'm receiving the error:
Call to a member function withBatchId() on array
When dispatch() is called.
There's not much discussion/support/articles around the new batch feature yet and I'm struggling to uncover exactly what's going wrong.
All help appreciated
Please or to participate in this conversation.