几天内即可获得 Laravel 代码审查方面的专家指导

Queue-Wide Inspection Methods in Laravel 13.8.0

发布日期 经过

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() 用于测试, SortDirection enum support in the query builder, and more:

  • allReservedJobs() , allDelayedJobs() , 和 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 命令
  • 风俗 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 — WorkerPausingWorkerResuming — 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 freezeTimetravelTo

参考

保罗·雷德蒙德照片

Laravel News 特约撰稿人。全栈 Web 开发人员兼作家。

归档于:
立方体

Laravel 时事通讯

加入超过 4 万名开发者的行列,不错过任何新的技巧、教程等内容。

图像
廷克威尔

这款编辑器专为快速反馈和快速迭代而设计,让您尽享编码和调试的乐趣。它就像您应用程序的一个外壳——但具备多行编辑、代码自动完成等更多功能。

参观廷克韦尔
PhpStorm 标志

PhpStorm

首选的 PHP IDE,对 Laravel 及其生态系统提供广泛的开箱即用支持。

PhpStorm
SaaSykit:Laravel SaaS 入门套件徽标

SaaSykit:Laravel SaaS 入门套件

SaaSykit 是一个多租户 Laravel SaaS 入门套件,包含运行现代 SaaS 所需的所有功能,例如支付、美观的结账界面、管理面板、用户仪表盘、身份验证、现成组件、统计数据、博客、文档等等。

SaaSykit:Laravel SaaS 入门套件
Kirschbaum 标志

樱桃树

提供创新和稳定性,确保您的Web应用程序取得成功。

樱桃树
几天内即可获得 Laravel 代码审查徽标的专家指导

几天内即可获得 Laravel 代码审查方面的专家指导

专家级代码审查!两位拥有 10 年以上 Laravel 开发经验的开发者将为您提供清晰、实用的反馈,帮助团队构建更优质的应用程序。

几天内即可获得 Laravel 代码审查方面的专家指导
鱼叉:新一代时间跟踪和发票标志

Harpoon:新一代时间跟踪和发票系统

新一代时间跟踪和计费软件,帮助您的机构规划和预测盈利的未来。

Harpoon:新一代时间跟踪和发票系统
Lucky Media 标志

幸运传媒

Get Lucky Now——拥有十余年经验的 Laravel 开发理想之选!

幸运传媒
Shift 标志

转移

还在运行旧版本的 Laravel?立即实现 Laravel 自动升级和代码现代化,让您的应用程序保持最新状态。

转移
了解 Softtech 的标志

了解软科技

Acquaint Softtech 提供 AI 就绪的 Laravel 开发人员,48 小时内即可上手,每月费用为 3000 美元,没有冗长的销售流程,并提供 100% 退款保证。

了解软科技
Laravel Cloud 标志

Laravel 云

轻松创建和管理服务器,并在几秒钟内部署 Laravel 应用程序。

Laravel 云
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
Tinkerwell 徽标

廷克威尔

Laravel 开发者必备的代码运行器。可在本地和生产环境中体验 AI、自动补全和即时反馈功能。

廷克威尔
Laravel ClickHouse: A Full-Featured ClickHouse Driver for Laravel image

Laravel ClickHouse: A Full-Featured ClickHouse Driver for Laravel

阅读文章
Laravel Installer Now Returns JSON When Running Inside an AI Agent image

Laravel Installer Now Returns JSON When Running Inside an AI Agent

阅读文章
Verifiable Audit Logging with Laravel Chronicle image

Verifiable Audit Logging with Laravel Chronicle

阅读文章
Ship AI with Laravel: Search Entire PDFs with Zero Search Logic image

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

阅读文章
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

阅读文章
Laravel Brain: Visualize Your Application's Request Lifecycle image

Laravel Brain: Visualize Your Application's Request Lifecycle

阅读文章