Laravel 10.24版本发布
Laravel  /  管理员 发布于 1年前   287
本周,Laravel 团队发布了 v10.24,其中包括作业伪造更新、字符串位置助手、迁移表名猜测改进等。
虽然我们在每个版本中都会强调新功能,但每周都有许多贡献者在改进框架。
请查看发布说明,了解每周发布的完整变化,感谢所有为 Laravel 做出贡献的人。
下面是本周的新内容概览:
允许伪造旧工作
蒂姆-麦克唐纳(Tim MacDonald)贡献了一个允许旧式队列作业推送的更新:
>目前不支持旧式的队列作业推送,即引用作业类并以数组形式传递有效载荷。
该更新修复了这一问题:
Queue::fake([MyJob::class]);
Queue::push(MyJob::class, ['job' => 'payload']);
Queue::assertPushed(MyJob::class);
引入 Str::substrPos() 方法
Clemens Bastian 提供了一个 substrPos() 方法,用于确定子串在字符串中首次出现的位置。
它是 PHP 的 mb_strpos 方法的封装:
// Str helper
Str::position('Hello, World!', 'W'); // 7
// Stringable
str('This is a test string.')->position('test'); // 10
// More examples
Str::position('This is a test string, test again.', 'test', 15); // 23
Str::position('Hello, World!', 'Hello'); // 0
Str::position('Hello, World!', 'World!'); // 7
Str::position('This is a tEsT string.', 'tEsT', 0, 'UTF-8'); // 10
Str::position('Hello, World!', 'W', -6); // 7
Str::position('Äpfel, Birnen und Kirschen', 'Kirschen', -10, 'UTF-8'); // 18
Str::position('@%€/=!"][$', '$', 0, 'UTF-8'); // 9
Str::position('Hello, World!', 'w', 0, 'UTF-8'); // false
Str::position('Hello, World!', 'X', 0, 'UTF-8'); // false
Str::position('', 'test'); // false
Str::position('Hello, World!', 'X'); // false
在迁移中正确猜测表名
Islam Abdelfattah 改进了表猜测功能,如果用户在迁移时修改了现有数据库表中的一列,那么猜测功能就会生效。
如果下面的命令以 to_users_table 结尾,该命令将正确创建用户表的迁移:
php artisan make:migration \
add_is_sent_to_3rd_party_service_column_to_users_table
上述命令生成的迁移将自动在上行/下行方法中包含以下代码:
Schema::table('users', function (Blueprint $table) {
//
});
版本说明
您可以在 GitHub 上查看以下新功能和更新的完整列表,以及 10.23.0 和 10.24.0 之间的差异。
以下版本说明直接来自更新日志:
https://github.com/laravel/framework/compare/v10.23.0...v10.24.0
https://github.com/laravel/framework/blob/1157523ae2a08449ddfbee737ecdc1479dc3df03/CHANGELOG.md#v10240---2023-09-19
v10.24.0
让查询生成器中连接方法的参数类型保持一致
@melicerte 发表于 https://github.com/laravel/framework/pull/48386
[10.x] 修复 view:cache 和 artisan up 后的文件竞赛条件
by @roxik in https://github.com/laravel/framework/pull/48368
[10.x] 重新启用 SQL Server CI
作者 @GrahamCampbell 发布于 https://github.com/laravel/framework/pull/48393
更新 request.stub
by @olivsinz in https://github.com/laravel/framework/pull/48402
[10.x] phpdoc: Auth\Access\Response 构造函数允许消息为空
by @snmatsui in https://github.com/laravel/framework/pull/48394
[10.x] 测试改进
@crynobone 发布于 https://github.com/laravel/framework/pull/48390
关闭 csrf_field 的自动完成功能
@maxheckel 发布于 https://github.com/laravel/framework/pull/48371
[10.x] 删除在测试中包含枚举的 PHP 8.1 检查
(由 @Jubeki 发布于 https://github.com/laravel/framework/pull/48415
[10.x] 改进命名方式
(由 @timacdonald 发布于 https://github.com/laravel/framework/pull/48413
[10.x] 修复调用 deleteDirectory 时出现的 "文本文件繁忙 "错误(
由 @ycs77 发布于 https://github.com/laravel/framework/pull/48422
修复小数字键的 Cache::many() 问题
(由 @AlexKarpan 在 https://github.com/laravel/framework/pull/48423 提供
[10.x]将动作/结账从 v3 更新到 v4
作者:@tamiroh 发表于 https://github.com/laravel/framework/pull/48439
lazyById不会检查数据库响应中id(别名)列的可用性,最终会无休止地循环,而chunkById会。
[10.x]允许伪造旧作业
by @timacdonald in https://github.com/laravel/framework/pull/48434
[10.x] 引入 Str::substrPos
by @amacado in https://github.com/laravel/framework/pull/48421
[10.x] 如果列名中包含('to'、'from'和/或'in')项,则在迁移中正确猜测表名
by @i350 in https://github.com/laravel/framework/pull/48437
[10.x] 重构 LazyCollection::take()以节省内存
@fuwasegu 发表于 https://github.com/laravel/framework/pull/48382
[10.x] 当默认值为枚举时获取值属性
(由 @squiaios 在 https://github.com/laravel/framework/pull/48452 提供
[10.x] 编译器助手的改进
@crynobone 发布于 https://github.com/laravel/framework/pull/48448
[10.x] 测试 Symfony v6.4
by @driesvints in https://github.com/laravel/framework/pull/48400
转:
https://laravel-news.com/laravel-10-24-0
122 在
学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..123 在
Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..原梓番博客 在
在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..博主 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..1111 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号