From 95857ecc3b5388a0ea2197f456215919cff8368e Mon Sep 17 00:00:00 2001 From: Amir Hossein Shokri Date: Mon, 9 Jun 2025 01:08:32 +0330 Subject: [PATCH 1/2] Update queues.md --- queues.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/queues.md b/queues.md index 3b899ebd0d0..9f105608036 100644 --- a/queues.md +++ b/queues.md @@ -1473,6 +1473,12 @@ class ImportCsv implements ShouldQueue } ``` +You can also create a batchable job using the `make:job` Artisan command with the `--batched` option: + +```shell +php artisan make:job ProcessPodcast --batched +``` + ### Dispatching Batches From 270b2c0153b02c034d4e59200163f13525807afc Mon Sep 17 00:00:00 2001 From: Amir Hossein Date: Mon, 9 Jun 2025 03:07:46 +0330 Subject: [PATCH 2/2] explain sync option in make:job command --- queues.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/queues.md b/queues.md index 9f105608036..b8afd07e050 100644 --- a/queues.md +++ b/queues.md @@ -175,6 +175,16 @@ php artisan make:job ProcessPodcast The generated class will implement the `Illuminate\Contracts\Queue\ShouldQueue` interface, indicating to Laravel that the job should be pushed onto the queue to run asynchronously. +### Create a Synchronous Job + +If you want the job to run immediately (synchronously) instead of being queued, you can use the `--sync` option: + +```bash +php artisan make:job ProcessPodcast --sync +``` + +This will generate a job class that **does not** implement the `Illuminate\Contracts\Queue\ShouldQueue` interface. The job will be executed in the same process as the request, which is useful for simple tasks or development/testing environments. + > [!NOTE] > Job stubs may be customized using [stub publishing](/docs/{{version}}/artisan#stub-customization).