Laravel 10.35版本发布
Laravel  /  管理员 发布于 1年前   319
Laravel 团队发布了 v10.35,新增了 Blade @use 指令、数字缩写助手、
使用 artisan down 生成秘密等功能。以下是关于本周推出的新特性的更多信息:
添加刀片 @use() 指令
Simon Hamp 提供了一个 @use() 指令,
用于在不使用原始 PHP 标记的情况下将 PHP 类导入 Blade 模板:
{{-- Before --}}
@php
use \App\Enums\WidgetStatusEnum as Status;
@endphp
{{-- After --}}
@use('App\Enums\WidgetStatusEnum', 'Status')
@use('App\Models\Bar')
{{ Status::Foo }}
{{ Bar::first() }}
使用 Number::abbreviate() 方法缩写数字
@jcsoriano 为新添加的 Number 类贡献了一个 Number::abbreviate() 类,
它提供了一个人类可读的缩写数字:
Number::abbreviate(1_000_000); // "1M"
Number::abbreviate(100_001); // "100K"
Number::abbreviate(100_100); // "100K"
Number::abbreviate(99_999); // "100K"
Number::abbreviate(99_499); // "99K"
为artisan down命令添加--with-secret选项
Jacob Daniel Prunkl 为 artisan down 命令提供了一个 --with-secret 选项,
它将生成一个用于绕过维护模式的密语,这样用户就不必自己定义密语了:
为 AssertableJson 类添加 Conditionable 特性
Khalil Laleh 为 AssertableJson 类添加了 Conditionable 特性,
从而可以根据给定条件进行断言:
// Before
$response->assertJson(function (AssertableJson $json) use ($condition) {
$json->has('data');
if ($condition) {
$json->has('meta');
}
$json->etc();
});
// After
$response
->assertJson(fn (AssertableJson $json) => $json->has('data'))
->when($condition, fn (AssertableJson $json) => $json->has('meta'))
// ...
;
版本说明
您可以在 GitHub 上查看以下新功能和更新的完整列表,以及 10.34.0 和 10.35.0 之间的差异。
以下版本说明直接来自更新日志:
https://github.com/laravel/framework/compare/v10.34.0...v10.35.0
https://github.com/laravel/framework/blob/d4e968433c44d1e637b2138e2ebfe89714ebf48b/CHANGELOG.md#v10350---2023-12-05
v10.35.0
[10.x]为 AssertableJson 添加可条件特质(Conditionable trait),
作者 @khalilst 发布于 https://github.com/laravel/framework/pull/49172
[10.x] 在 Artisan down 命令中添加 --with-secret 选项。
作者:@jj15asmr 发布于 https://github.com/laravel/framework/pull/49171
[10.x] 添加对 Number::summarize 的支持
@jcsoriano 发表于 https://github.com/laravel/framework/pull/49197
[10.x] 添加 Blade @use 指令
(作者:@simonhamp,发布于 https://github.com/laravel/framework/pull/49179
[10.x] 由 @crynobone 在 https://github.com/laravel/framework/pull/49186
中提出的修复重试失败作业导致 PHP 内存耗尽错误的问题。
[10.x] 在路由器中添加 "substituteImplicitBindingsUsing "方法,
作者 @calebporzio 发布于 https://github.com/laravel/framework/pull/49200
[10.x] 具有独立分区状态的 Cookie (CHIPS)
作者:@fabricecw 发布于 https://github.com/laravel/framework/pull/48745
[10.x] 更新 InteractsWithDictionary.php 以使用基本的 InvalidArgumentException(无效异常)
作者 @Grldk 发布于 https://github.com/laravel/framework/pull/49209
[10.x] 修正 wasRecentlyCreated 的 docblock,
作者 @stancl,收录于 https://github.com/laravel/framework/pull/49208
[10.x] 修复调用子组件后属性丢失的问题,
作者 @rojtjo 发布于 https://github.com/laravel/framework/pull/49216
[10.x] 修复 PHPDoc 注释中的错字,
作者 @caendesilva,原文地址:https://github.com/laravel/framework/pull/49234
[10.x] 确定给定视图是否存在。
作者:@hafezdivandari 发布于 https://github.com/laravel/framework/pull/49231
转:
https://laravel-news.com/laravel-10-35-0
122 在
学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..123 在
Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..原梓番博客 在
在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..博主 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..1111 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号