文章转发自专业的Laravel开发者社区,原始连接:learnku.com/laravel/t/3…laravel
Laravel 团队宣布 Laravel v6.0.4 即将发布。 此版本包括计划任务事件、新的 JSON 断言方法和全部最新更改。git
让咱们来看看这个版本中的一些亮点新特性:github
首先,在 TestResponse 类中添加了一个 assertJsonPath()
断言,对于在 JSON 响应中使用针对嵌套属性的点符号断言值,这个断言很是方便:sql
$this->getJson(route('api.post.show', [$post->id]))
->assertJsonPath('tags', [])
->assertJsonPath('comments.0.user.username', 'ecrmnn')
->assertJsonPath('comments.*.body', [
'First!',
'This is my comment',
]);
复制代码
接着,不论生成器类是否有全局/本地的宏,为了便于断言,向 Eloquent
生成器添加三个新的访问方法:api
$builder->hasMacro($name);
$builder->getGlobalMacro($name);
$builder->hasGlobalMacro($name);
复制代码
向 BelongsToMany
关联添加另外一个访问方法来获取中间表的列:bash
$example->getPivotColumns();
复制代码
接着,为定时任务准备两个事件:ScheduledTaskStarting
和 ScheduledTaskFinished
。 你能够在 Michael Dyrynda 的文章 Pull Request #29888 中学习更多这些事件的相关内容。相信你朋友。函数
此版本中的最后一个新更新是容许使用 inputargument
和 inputoption
对象定义命令参数和选项:post
// 当前样式,仍受支持
protected function getArguments()
{
return [
['name', InputArgument::REQUIRED, 'the argument\'s description', 'default value'], ]; } // 新风格 protected function getArguments() { return [ new InputArgument('name', InputArgument::REQUIRED, 'the argument\'s description', 'default value'),
];
}
复制代码
这个特性以向后兼容的方式工做,只是添加了另外一种定义参数和选项的替代方式。学习
您能够在下面看到修复的完整列表,以及 Github 上 6.0.3 和 6.0.4 之间的所有差别。 Laravel 5.8 的完整发行说明可在 Github v6 changelog 中找到:测试
TestResponse::assertJsonPath()
方法 (#29957)Eloquent Builder
添加了 hasglobalmacro
、 getglobalmacro
、hasglobalmacro
方法 (#30008)Illuminate\Database\Eloquent\Relations\BelongsToMany::getPivotColumns()
方法(#30049)ScheduledTaskFinished
\ ScheduledTaskStarting
计划任务运行时发出信号的事件 (#29888)InputArgument
\ InputOption
对象的命令参数和选项 (#29987)__()
和 null
参数 (#29967)updated_at
列的问题 (#29970)Illuminate\Redis\Limiters\ConcurrencyLimiter
(#30005)Responsable
接口的响应对象实例时的 VerifyCsrfToken
中间件 (#29972)Postgresql
列建立时没有可选精度的问题 (#29873)allowed
异常添加 NotFoundHttpException
的问题(#29975)0
/false
禁用加密成为可能 (#29985)validate dimensions
中容许 symfony
文件实例 (#30009)pendingmail
中设置语言环境 (dd1e0a6)