Courses

Queues in Laravel 12

Skip Processing Job

You're reading a FREE PREVIEW of a PREMIUM course.
Summary of this lesson:
- Implementing job skipping functionality with Skip::when() middleware
- Adding middleware in the job class using the middleware() method
- Creating conditions to skip job execution based on specific criteria (e.g., email verification status)
- Jobs are marked as processed but their handle() method is not executed when skipped

In this lesson, we'll explore how to skip processing jobs conditionally in Laravel queues, when queued jobs should be bypassed instead of executed.


Don't Process Job On Condition

Sometimes you might need to skip processing a job based on certain conditions. For example, imagine you've delayed dispatching a job when a user registers (as we saw in a previous lesson), but by the time the job is processed, the user still hasn't verified their email, making the job unnecessary.

Laravel provides an elegant way to handle this using job middleware.


Using Skip Middleware

Jobs can have...

The full lesson is only for Premium Members.
Want to access all 15 lessons of this course? (46 min read)

You also get:

  • 76 courses
  • Premium tutorials
  • Access to repositories
  • Private Discord