Polyscope - The agent-first dev environment for Laravel

Queue-Wide Inspection Methods in Laravel 13.8.0

Last updated on by

Queue-Wide Inspection Methods in Laravel 13.8.0 image

Laravel v13.8.0 adds methods for inspecting jobs across all queues in a single call, plus new worker pause/resume events, assertSessionMissingInput() for testing, SortDirection enum support in the query builder, and more:

  • allReservedJobs(), allDelayedJobs(), and allPendingJobs() queue inspection methods
  • Worker Pausing and Resuming events
  • assertSessionMissingInput() test assertion
  • SortDirection enum support for query builder orderBy() and related methods
  • Environment filter for the schedule:list command
  • Custom onDelete()/onUpdate() actions for foreign keys
  • Attribute-provided middleware now merges with route middleware
  • Mail default driver now accepts backed enums
  • Named credential providers for SQS queue connections
  • Various type fixes and docblock improvements

What's New

Queue-Wide Inspection Methods

The existing Queue::reservedJobs(), Queue::delayedJobs(), and Queue::pendingJobs() methods require a specific queue name, which means checking multiple queues requires chaining calls. This release adds allReservedJobs(), allDelayedJobs(), and allPendingJobs() to retrieve jobs across every queue in a single call:

// Before — one query per queue
Queue::reservedJobs('queue1')
->merge(Queue::reservedJobs('queue2'))
->merge(Queue::reservedJobs('queue3'));
 
// After — one call for all queues
Queue::allReservedJobs();
Queue::allDelayedJobs();
Queue::allPendingJobs();

Each method returns a collection of InspectedJob instances with uuid, name, attempts, and createdAt properties. This is useful during deployments when you need to confirm no jobs are actively running before stopping workers. The methods work with the database, Redis, and fake queue drivers.

PR: #59997

Worker Pausing and Resuming Events

Two new events — WorkerPausing and WorkerResuming — are now dispatched when a queue worker receives SIGUSR2 or SIGCONT signals respectively. These events give applications visibility into worker state transitions, useful for logging or alerting when workers pause and resume during deployments.

PR: #59895

assertSessionMissingInput() Test Assertion

TestResponse now includes assertSessionMissingInput() as the counterpart to the existing assertSessionHasInput(). It accepts a single field name or an array of field names:

$response->assertSessionMissingInput('name');
 
$response->assertSessionMissingInput(['connection_id', 'repository', 'source_branch']);

PR: #59970

SortDirection Enum in Query Builder

Following the SortDirection enum support added to collections in 13.7.0, query builder methods like orderBy(), orderByDesc(), and orderByRaw() now accept the native PHP SortDirection enum (introduced in PHP 8.6):

use SortDirection;
 
DB::table('users')
->orderBy('name', SortDirection::Descending)
->get();

PR: #59865

Environment Filter for schedule:list

The schedule:list Artisan command now accepts an --environment option to filter scheduled tasks by the environments they run in:

php artisan schedule:list --environment=production

This is helpful when running schedule:list on production to see only the commands that will actually execute in that environment, rather than seeing commands restricted to local or staging.

PR: #59993

Custom onDelete()/onUpdate() Actions for Foreign Keys

The ForeignKeyDefinition class now accepts custom strings for onDelete() and onUpdate() beyond the standard cascade, restrict, no action, and set null. This resolves a PHPStan conflict when using PostgreSQL's partial SET NULL syntax for composite foreign keys:

$table->foreign(['document_id', 'client_id'])
->references(['id', 'client_id'])
->on('documents')
->onDelete('set null (document_id)');

PR: #59986

Attribute Middleware Now Merges with Route Middleware

Previously, the #[Middleware] attribute on a controller or method was ignored if the route also had middleware defined through other means. Attribute-provided middleware now merges with middleware from other sources instead of being discarded.

PR: #59944

Named Credential Providers for SQS

SQS queue connections now support named AWS credential providers, which allows using specific credential profiles or chains defined in the AWS SDK rather than only environment variables or instance metadata:

// config/queue.php
'sqs' => [
'driver' => 'sqs',
'credentials' => 'my-named-provider',
// ...
],

PR: #59754

Mail Default Driver Accepts Enums

MailManager::setDefaultDriver() now accepts backed enums in addition to strings, matching the enum support already available in mailer() and driver():

Mail::setDefaultDriver(MailDriver::Smtp);

PR: #59973

Miscellaneous Fixes and Improvements

This release includes a large set of type annotation and docblock improvements from @mosabbirrakib, @AJenbo, @jnoordsij, and others — covering schema builders, cache, factory, collections, and more. Additional fixes include: expired locks now excluded from DatabaseLock::isLock, fixes for macros with static closures, ModelNotFoundException UnitEnum support, infinite rate limiter TTL on custom increments, and callable type corrections for freezeTime and travelTo.

References

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
SerpApi

The Web Search API for Your LLM and AI Applications

Visit SerpApi
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
SerpApi logo

SerpApi

Access real-time search engine results through a simple API—no more scraping headaches! Use it for AI applications, SEO tools, product research, travel information, and more

SerpApi
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell

The latest

View all →
Verifiable Audit Logging with Laravel Chronicle image

Verifiable Audit Logging with Laravel Chronicle

Read article
Ship AI with Laravel: Search Entire PDFs with Zero Search Logic image

Ship AI with Laravel: Search Entire PDFs with Zero Search Logic

Read article
Personalized Content Delivery System: Building an AI-powered recommendation engine with Laravel and MongoDB image

Personalized Content Delivery System: Building an AI-powered recommendation engine with Laravel and MongoDB

Read article
Laravel Brain: Visualize Your Application's Request Lifecycle image

Laravel Brain: Visualize Your Application's Request Lifecycle

Read article
Laravel Shopper: A Headless E-Commerce Admin Panel for Laravel image

Laravel Shopper: A Headless E-Commerce Admin Panel for Laravel

Read article
Chevere Workflow: A Declarative PHP Workflow Engine with Async Job Execution image

Chevere Workflow: A Declarative PHP Workflow Engine with Async Job Execution

Read article