News

Queue-Wide Inspection Methods in Laravel 13.8.0

Published
Queue-Wide Inspection Methods in Laravel 13.8.0 image

Release updates

Never miss a Laravel release

Get an email whenever a new Laravel release lands.

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.

Sponsored

acquaintsoft logo
Acquaint Softtech

Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

Visit Acquaint Softtech

The latest

View all →
CPX: The Composer Package Executor for PHP image

CPX: The Composer Package Executor for PHP

Read article
Laravel AI SDK Adds Human-in-the-Loop Tool Approval image

Laravel AI SDK Adds Human-in-the-Loop Tool Approval

Read article
Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals image

Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals

Read article
Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs image

Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs

Read article
Blade Formatting in Laravel Pint image

Blade Formatting in Laravel Pint

Read article
Inertia DevTools Is Now on the Chrome Web Store image

Inertia DevTools Is Now on the Chrome Web Store

Read article