Laravel - Queues - Returning Batches From Routes

All Illuminate\Bus\Batch instances are JSON serializable, meaning you can return them directly from one of your application's routes to retrieve a JSON payload containing information about the batch, including its completion progress. This makes it convenient to display information about the batch's completion progress in your application's UI.

To retrieve a batch by its ID, you may use the Bus facade's findBatch method:

    
    use Illuminate\Support\Facades\Bus;
    use Illuminate\Support\Facades\Route;
    
    Route::get('/batch/{batchId}', function (string $batchId) {
        return Bus::findBatch($batchId);
    });