Skip to content

Conversation

hafezdivandari
Copy link
Contributor

This PR adds --batched option to make:job command to make batchable jobs:

php artisan make:job ProcessPodcast --batched

@taylorotwell taylorotwell merged commit 7eecb78 into laravel:12.x Jun 4, 2025
59 checks passed
@hafezdivandari hafezdivandari deleted the 12.x-make-batchable-job branch June 4, 2025 15:45
*/
public function handle(): void
{
if ($this->batch()->cancelled()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I'm wrong. Just because a job can be batched, doesn't necessarily mean that it will be batched. It's possible that it can be dispatched to the queue on it's own. In that case $this->batch() will return null.

Suggested change
if ($this->batch()->cancelled()) {
if ($this->batch()?->cancelled()) {

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.

3 participants