This week, the Laravel team unveiled version 10.37, featuring notable enhancements such as the capability to store batch metadata in DynamoDB, the ability to assert multiple errors on a field, and several other additions. Let's delve into more details about the new features introduced in this release:
Storing batches in DynamoDB
Sebastien Armand made a significant contribution by enabling the storage of batch metadata in DynamoDB, offering an alternative to using a relational database. To configure your application to utilize DynamoDB, you can implement the following configuration in your queue.php
configuration 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',
],
For comprehensive setup details, refer to the documentation, and for a more in-depth understanding of the implementation, explore the details provided in Pull Request #49169.
Assert multiple error messages
Tim MacDonald has introduced a valuable contribution, enabling the ability to assert a list of errors on a field through the assertInvalid()
method. This enhancement offers a more flexible and precise way to handle error assertions in Laravel testing.
// Before, separate assertion calls are required
$response->assertInvalid(['email' => 'The email field must be a string.']);
$response->assertInvalid(['email' => 'The email field must be at least 5 characters.']);
// As of Laravel 10.37 you can now do:
$response->assertInvalid([
'email' => [
'The email field must be a string.',
'The email field must be at least 5 characters.',
],
]);
Add engine()
method to Blueprint
James Brooks has made a noteworthy contribution by introducing the engine()
method when defining migration schemas. This enhancement provides additional control and customization options for defining the database engine during the migration process.
// Previously
Schema::table('foo', function (Blueprint $table) {
$table->engine = 'InnoDB';
// ...
});
// Using the new engine() method
Schema::table('foo', function (Blueprint $table) {
$table->engine('InnoDB');
// ...
});
Get the indexes and foreign keys of a table
Hafez Divandari has made a valuable contribution by adding getIndexes()
and getForeignKeys()
methods. These methods allow you to retrieve information about the indexes and foreign keys of a given table schema, providing enhanced capabilities for managing and inspecting database structures.
Schema::getIndexes();
Schema::getForeignKeys();
In detail, the getIndexes()
method returns an array containing various keys such as name, columns, type, unique, and primary. On the other hand, the getForeignKeys()
method returns an array for each foreign key, providing details like name, columns, foreign_schema, foreign_table, foreign_columns, on_update, and on_delete. These methods offer comprehensive insights into the structure and relationships of the given table schema.
For a deeper understanding of the implementation details and examples related to these enhancements, refer to Pull Request #49204 and Pull Request #49264. These pull requests offer valuable insights into the changes and additions made by the contributors.
Release notes
Certainly! To explore the complete list of new features and updates, as well as the differences between versions 10.35.0 and 10.37.0, you can refer to the GitHub repository. The following release notes are directly sourced from the changelog, providing a detailed overview of the changes introduced in this version.
v10.37.0
- [10.x] Add
engine
method toBlueprint
by @jbrooksuk in https://github.com/laravel/framework/pull/49250 - [10.x] Use translator from validator in
Can
andEnum
rules by @fancyweb in https://github.com/laravel/framework/pull/49251 - [10.x] Get indexes of a table by @hafezdivandari in https://github.com/laravel/framework/pull/49204
- [10.x] Filesystem : can lock file on append of content by @StephaneBour in https://github.com/laravel/framework/pull/49262
- [10.x] Test Improvements by @crynobone in https://github.com/laravel/framework/pull/49266
- [10.x] Fixes generating facades documentation shouldn't be affected by
php-psr
extension by @crynobone in https://github.com/laravel/framework/pull/49268 - [10.x] Fixes
AboutCommand::format()
docblock by @crynobone in https://github.com/laravel/framework/pull/49274 - [10.x]
Route::getController()
should returnnull
when the accessing closure based route by @crynobone in https://github.com/laravel/framework/pull/49269 - [10.x] Add "noActionOnUpdate" method in Illuminate/Database/Schema/ForeignKeyDefinition by @hrsa in https://github.com/laravel/framework/pull/49297
- [10.x] Fixing number helper for floating 0.0 by @mr-punyapal in https://github.com/laravel/framework/pull/49277
- [10.x] Allow checking if lock succesfully restored by @Joostb in https://github.com/laravel/framework/pull/49272
- [10.x] Enable DynamoDB as a backend for Job Batches by @khepin in https://github.com/laravel/framework/pull/49169
- [10.x] Removed deprecated and not used argument by @Muetze42 in https://github.com/laravel/framework/pull/49304
- [10.x] Add Conditionable to Batched and Chained jobs by @bretto36 in https://github.com/laravel/framework/pull/49310
- [10.x] Include partitioned tables on PostgreSQL when retrieving tables by @hafezdivandari in https://github.com/laravel/framework/pull/49326
- [10.x] Allow to pass
Arrayable
orStringble
in rulesIn
andNotIn
by @michaelnabil230 in https://github.com/laravel/framework/pull/49055 - [10.x] Display error message if json_encode() fails by @aimeos in https://github.com/laravel/framework/pull/48856
- [10.x] Allow error list per field by @timacdonald in https://github.com/laravel/framework/pull/49309
- [10.x] Get foreign keys of a table by @hafezdivandari in https://github.com/laravel/framework/pull/49264
- [10.x] PHPStan Improvements by @crynobone in https://github.com/laravel/framework/pull/49343
- [10.x] Handle missing translations: more robust handling of callback return value by @DeanWunder in https://github.com/laravel/framework/pull/49341