Kick-start Accessibility Journey with All in One Accessibility®
Get 20% OFF! Use Coupon Code* HOLIDAY20 Terms and conditions apply

Laravel 10.37.0 has been Released – What are the new features?

By: Skynet Technologies USA LLC
8 mins
500
Laravel 10.37.0

Lately, Laravel unveiled its latest version 10.37.0 with few notable features such as the ability to assert multiple errors on a field, the capability to store batch metadata in DynamoDB, and many more. These enhancements will bring more design opportunities for Laravel applications.

Let’s explore the new additions in the latest release Laravel 10.37.0.

Noticeable latest features shipped along with Laravel 10.37.0

Storing batches in DynamoDB

It is a contributed feature. Storing batch meta information in DynamoDB in the place of the relational database. Configure your application to utilize DynamoDB by applying the below config in queue.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',
],

Documentation will help you to understand complete setup details. Moreover, check Pull Request #49169 for implementation details.

Assert Multiple Error Messages

This contributed feature can assert a list of errors on a field utilizing the assertInvalid() method:

// 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

The engine() method helps define migration schemas and it is again a contributed feature.

// 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

getIndexes() and getForeignKeys methods to get the indexes and foreign keys of a given table schema.

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

This contributed method ‘getIndexes()’ returns an array with different keys like ‘name’, ‘column’, ‘type’, ‘unique’, and ‘primary’. And the ‘getForeignKeys()’ method returns an array for each foreign key with ‘name’, ‘column’, ‘foreign_schema’, ‘foreign_table’, ‘foreign_columns’, ‘on_update’, and ‘on_delete’.

Pull Request #49204 and Pull Request #49264 for implementation details and examples.

Release Notes for Laravel 10.37.0

To know more about all the updates and bug fixes along with differences from Laravel 10.35.0 and 10.37.0, check the below-mentioned GitHub links.

[10.x] Add engine method to Blueprint by @jbrooksuk in https://github.com/laravel/framework/pull/49250

[10.x] Use translator from validator in Can and Enum 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 return null 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 or Stringble in rules In and NotIn 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

Migration from the previous version to the Laravel latest version

There are six commands in Laravel to migrate from one version to another. To view the migration commands, open the Git bash window and enter the command “php artisan list”. You will get to see all the commands in the command lists.

laravel latest version

Here highlighted area is the list of migration commands. You can migrate to the latest version by using these six commands:

migrate:fresh: is used to drop all the tables from the database and then the command re-runs all the migrations.

migrate:install: creates the migration table in a database.

migrate:refresh: is used to roll back all the migrations and re-run them. The command is used to re-create the whole database.

migrate:reset: it drops all the tables that you have created in the database.

migrate:rollback: rollbacks the last database migration.

migrate:status: is used to show the status of each migration.

Wrapping up

Migrate Laravel applications to ensure efficiency. The latest Laravel 10.37.0 is another version with required bug fixes and much-needed updates. Thus, check all technical requirements of your existing Laravel application and update it.

Skynet Technologies provide custom Laravel development services such as Laravel enterprise solution, Restful App development, Laravel upgrades, Laravel migration, and more suitable for small to large scale business across all the industries. Hire Laravel developers or reach out [email protected].

107