In this episode, we dive into inspecting the status of your Laravel batches. There are two main approaches: you can chain callback methods like progress
or failed
directly onto your batch, or you can fetch the batch using its ID and inspect it manually. We focus on the first method here, showing you how to use the progress
callback to track how far along your batch jobs are.
We walk through setting up the progress
callback so you can log out the batch progress as your jobs run. You'll see how the percentage updates as each job finishes (for example, moving from 33% to 67% and then to 100%). We also go over clearing your database and logs for a clean slate, and starting your queue worker with php artisan queue:work
so everything is ready.
Towards the end, we preview what's coming next: we'll use the progress data to update each job's state in the database, so you can keep track of every job in the batch individually. Plus, we'll touch on how to use that batch info on the UI to show cancel status and other states. So by the end of this episode, you'll know exactly how to monitor and log your batch progress—setting the foundation for even more powerful tracking in the upcoming episodes.