Laravel v13.8.0 adds methods for inspecting jobs across all queues in a single call, plus new worker pause/resume events,
assertSessionMissingInput()
用于测试,
SortDirection
enum support in the query builder, and more:
allReservedJobs(),allDelayedJobs(), 和allPendingJobs()queue inspection methods- Worker Pausing and Resuming events
assertSessionMissingInput()test assertionSortDirectionenum support for query builderorderBy()and related methods- Environment filter for the
schedule:list命令 - 风俗
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
什么是新的
Queue-Wide Inspection Methods
现有的
Queue::reservedJobs()
,
Queue::delayedJobs()
, 和
Queue::pendingJobs()
methods require a specific queue name, which means checking multiple queues requires chaining calls. This release adds
allReservedJobs()
,
allDelayedJobs()
, 和
allPendingJobs()
to retrieve jobs across every queue in a single call:
// Before — one query per queue队列
::
reservedJobs
(
'queue1'
)
->
合并
(
队列
::
reservedJobs
(
'queue2'
))
->
合并
(
队列
::
reservedJobs
(
'queue3'
));// After — one call for all queues队列
::
allReservedJobs
();队列
::
allDelayedJobs
();队列
::
allPendingJobs
();
Each method returns a collection of
InspectedJob
实例
uuid
,
name
,
attempts
, 和
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.
公关稿: #59997
Worker Pausing and Resuming Events
Two new events —
WorkerPausing
和
WorkerResuming
— are now dispatched when a queue worker receives
SIGUSR2
或者
SIGCONT
signals respectively. These events give applications visibility into worker state transitions, useful for logging or alerting when workers pause and resume during deployments.
公关稿: #59895
assertSessionMissingInput()
测试断言
TestResponse
now includes
assertSessionMissingInput()
as the counterpart to the existing
assertSessionHasInput()
. It accepts a single field name or an array of field names:
$响应
->
assertSessionMissingInput
(
'姓名'
(英文):$响应
->
assertSessionMissingInput
([
'connection_id'
,
'存储库'
,
'source_branch'
]);
公关稿: #59970
SortDirection
Enum in Query Builder
继
SortDirection
enum support added to collections in 13.7.0, query builder methods like
orderBy()
,
orderByDesc()
, 和
orderByRaw()
now accept the native PHP
SortDirection
enum (introduced in PHP 8.6):
使用
SortDirection
;数据库
::
桌子
(
“用户”
)
->
orderBy
(
'姓名'
,
SortDirection
::
Descending
)
->
得到
();
公关稿: #59865
Environment Filter for
schedule:list
这
schedule:list
Artisan command now accepts an
--environment
option to filter scheduled tasks by the environments they run in:
php
工匠
时间表:清单
--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.
公关稿: #59993
风俗
onDelete()
/
onUpdate()
Actions for Foreign Keys
这
ForeignKeyDefinition
class now accepts custom strings for
onDelete()
和
onUpdate()
beyond the standard
cascade
,
restrict
,
no action
, 和
set null
. This resolves a PHPStan conflict when using PostgreSQL's partial
SET NULL
syntax for composite foreign keys:
$表
->
外国的
([
'document_id'
,
‘客户端 ID’
])
->
参考
([
'ID'
,
‘客户端 ID’
])
->
在
(
“文件”
)
->
删除
(
'set null (document_id)'
(英文):
公关稿: #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.
公关稿: #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'平方'
=>
[
'司机'
=>
'平方'
,
'credentials'
=>
'my-named-provider'
,
// ...],
公关稿: #59754
Mail Default Driver Accepts Enums
MailManager::setDefaultDriver()
now accepts backed enums in addition to strings, matching the enum support already available in
mailer()
和
driver()
:
邮件
::
setDefaultDriver
(
MailDriver
::
Smtp
(英文):
公关稿: #59973
其他修复和改进
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
和
travelTo
。
参考







