Laravel 10.37.0已经发布-有哪些新特性?

By: Skynet Technologies USA LLC
Dec 23, 23
Dec 23, 23
Laravel 10.37.0

最近,Laravel发布了最新版本10.37.0,只有一些值得注意的特性,比如在一个字段上断言多个错误的能力, 在DynamoDB中存储批处理元数据的能力, and many more. 这些增强将为Laravel应用程序带来更多的设计机会.

让我们来探索一下最新版本Laravel 10中的新功能.37.0.

与Laravel 10一起发布的最新功能值得注意.37.0

Storing batches in DynamoDB

It is a contributed feature. 在DynamoDB中存储批处理元信息,取代关系数据库. 通过在队列中应用以下配置来配置应用程序以利用DynamoDB.php file

'batching' => [
  'driver' => env('QUEUE_FAILED_DRIVER', 'dynamodb'),
  'key' => env('AWS_ACCESS_KEY_ID'),
  'secret' => env('AWS_SECRET_ACCESS_KEY'),
  'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
  'table' => 'job_batches',
],

文档将帮助您理解完整的设置细节. 此外,查看Pull Request #49169了解实现细节.

Assert Multiple Error Messages

这个贡献的特性可以使用assertInvalid()方法断言字段上的错误列表:

//之前,需要单独的断言调用
$response->assertInvalid(['email' => 'The email field must be a string.']);
$response->assertInvalid(['email' => 电子邮件字段必须至少有5个字符.']);
// As of Laravel 10.37 you can now do:
$response->assertInvalid([
  'email' => [
    'The email field must be a string.',
    电子邮件字段必须至少有5个字符.',
  ],
]);

Add ‘engine()’ method to Blueprint

engine()方法帮助定义迁移模式,它也是一个贡献特性.

// Previously
Schema::table('foo', function (Blueprint $table) {
  $table->engine = 'InnoDB';
  // ...
});
// Using the new engine() method
Schema::table('foo', function (Blueprint $table) {
  $table->engine('InnoDB');
  // ...
});

获取表的索引和外键

getIndexes()和getForeignKeys方法来获取给定表模式的索引和外键.

Schema::getIndexes();
Schema::getForeignKeys();

此贡献的方法' getIndexes() '返回具有不同键的数组,例如' name ', ‘column’, ‘type’, ‘unique’, and ‘primary’. getForeignKeys()方法为每个带有name的外键返回一个数组。, ‘column’, ‘foreign_schema’, ‘foreign_table’, ‘foreign_columns’, ‘on_update’, and ‘on_delete’.

有关实现细节和示例的Pull Request #49204和Pull Request #49264.

Release Notes for Laravel 10.37.0

了解更多关于所有更新和错误修复以及与Laravel 10的差异.35.0 and 10.37.0, check the below-mentioned GitHub links.

[10.添加引擎方法到蓝图@jbrooksuk in http://github.com/laravel/framework/pull/49250

[10.@fancyweb在Can和Enum规则中使用验证器的转换器 http://github.com/laravel/framework/pull/49251

[10.通过@hafezdivandari in获取表的索引 http://github.com/laravel/framework/pull/49204

[10.文件系统:可以通过@ stephanebrour in将文件锁定在内容的追加部分 http://github.com/laravel/framework/pull/49262

[10.x] Test Improvements by @crynobone in http://github.com/laravel/framework/pull/49266

[10.修复了生成facade文档不应该受到php-psr扩展@crynobone in的影响 http://github.com/laravel/framework/pull/49268

[10.修复了AboutCommand::format() docblock by @crynobone in http://github.com/laravel/framework/pull/49274

[10.Route::getController()在通过@crynobone访问基于闭包的路由时应该返回null http://github.com/laravel/framework/pull/49269

[10.添加“noActionOnUpdate”方法在照亮/数据库/Schema/ForeignKeyDefinition @hrsa in http://github.com/laravel/framework/pull/49297

[10.x] Fixing number helper for floating 0.0 by @mr-punyapal in http://github.com/laravel/framework/pull/49277

[10.允许检查锁是否被@Joostb in成功恢复 http://github.com/laravel/framework/pull/49272

[10.启用DynamoDB作为作业批处理的后端@khepin in http://github.com/laravel/framework/pull/49169

[10.[x]删除了@Muetze42的不推荐和未使用的参数 http://github.com/laravel/framework/pull/49304

[10.添加可条件的批处理和链式作业@bretto36 in http://github.com/laravel/framework/pull/49310

[10.当通过@hafezdivandari in检索表时,在PostgreSQL上包含分区表 http://github.com/laravel/framework/pull/49326

[10.允许在规则in和NotIn中通过@michaelnabil230传入Arrayable或Stringble http://github.com/laravel/framework/pull/49055

[10.如果json_encode()通过@aimeos in失败,则显示错误消息 http://github.com/laravel/framework/pull/48856

[10.允许每个字段的错误列表@timacdonald in http://github.com/laravel/framework/pull/49309

[10.通过@hafezdivandari in获取表的外键 http://github.com/laravel/framework/pull/49264

[10.x] PHPStan Improvements by @crynobone in http://github.com/laravel/framework/pull/49343

[10.处理丢失的翻译:通过@DeanWunder in更健壮地处理回调返回值 http://github.com/laravel/framework/pull/49341

从旧版本迁移到Laravel最新版本

在Laravel中有六个命令可以从一个版本迁移到另一个版本. 要查看迁移命令,打开Git bash窗口并输入命令" php artisan list ". 您将在命令列表中看到所有命令.

laravel latest version

这里突出显示的区域是迁移命令列表. 您可以使用以下六个命令迁移到最新版本:

Migrate:fresh:用于从数据库中删除所有表,然后该命令重新运行所有迁移.

Migrate:install:在数据库中创建迁移表.

Migrate:refresh:回滚所有迁移并重新运行. 该命令用于重新创建整个数据库.

Migrate:reset:删除在数据库中创建的所有表.

Migrate:rollback:回滚上一次数据库迁移.

Migrate:status:显示每次迁移的状态.

Wrapping up

迁移Laravel应用程序以确保效率. The latest Laravel 10.37.0是另一个需要修复错误和急需更新的版本. 因此,检查现有Laravel应用程序的所有技术要求并更新它.

Skynet Technologies提供定制的Laravel开发服务,如Laravel企业解决方案, Restful App development, Laravel upgrades, Laravel migration, 更适合所有行业的小型到大型企业. Hire Laravel developers or reach out [email protected].

Website
58