Skip to content

Conversation

Luke-Shepp
Copy link

@Luke-Shepp Luke-Shepp commented Aug 1, 2025

Adds Macroable to the PendingBatch class.

This allows chaining custom methods on Bus::batch, one example (and our use case) being to add better ide visibility into the available queues;

Bus::batch($jobs)->onHighQueue()->dispatch();

// instead of
Bus::batch($jobs)->onQueue('high')->dispatch();

See previous accepted PR's of adding Macroable to other places;

@taylorotwell
Copy link
Member

Can you use enums for your queues?

@Luke-Shepp
Copy link
Author

@taylorotwell

Can you use enums for your queues?

Sure, you can use plain strings too. The point is to have a method there instead.

It can be used for more than picking a queue too though, as is the nature with custom macros. On other example;

Bus::batch($jobs)->thenNotify($user)->dispatch() 

Not sure why it's been closed when it's a useful feature, is in place elsewhere, and adds no additional maintenance burden to the project going forward.

Take a look at the URI Macroable PR, the same example can be achieved without a macro - and was accepted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants