Laravel 9.24 Released

News

August 10th, 2022

laravel9-1646792144.jpg

The Laravel team released 9.24 with new artisan "db" commands, a new built-in validation rule, restoring soft-deleted models without any events, and more:

New database artisan commands

James Brooks and Joe Dixon contributed three new Artisan commands for databases: db:show, db:table, and db:monitor.

First, db:show gives you an overview of the database. It includes things like DB type, version, username, and more.

db:show example output

Next, the db:table command lets you see details about a table, including the number of rows, column details, indexes, and more.

db:table example output

Last, the db:monitor command lets you see things like the number of connections to the database.

db:monitor example output

Images are from Pull Request #43367, which has all the details about these commands.

A "does not end with" validation rule

@kichetof contributed a doesnt_end_with validation rule to check if a string doesn't end with a given substring. Here's an example from the pull request tests:

1// Validation passes
2$v = new Validator(
3 $trans,
4 ['x' => 'hello world'],
5 ['x' => 'doesnt_end_with:hello']
6);
7 
8$this->assertTrue($v->passes());
9 
10// Validation fails
11$v = new Validator(
12 $trans,
13 ['x' => 'hello world'],
14 ['x' => 'doesnt_end_with:world']
15);
16 
17$this->assertFalse($v->passes());

Restore a "soft deleted" model without events

Venelin Iliev contributed a restoreQuietly() method that restores a soft-deleted model without raising any events.

1$deletedModel->restoreQuietly();

Make Config repository macroable

Chris Kankiewicz contributed to adding the macroable trait to the Config repository so users can extend it in their apps:

1config()->macro('sayHello', function () {
2 return 'Hello, world';
3});
4 
5config()->sayHello(); // Hello, world

Release Notes

You can see the complete list of new features and updates below and the diff between 9.23.0 and 9.24.0 on GitHub. The following release notes are directly from the changelog:

v9.24.0

Added

  • New db:show, db:table and db:monitor commands (#43367)
  • Added validation doesnt_end_with rule (#43518)
  • Added Illuminate/Database/Eloquent/SoftDeletes::restoreQuietly() (#43550)
  • Added mergeUnless to resource ConditionallyLoadsAttributes trait (#43567)
  • Added Illuminate/Support/Testing/Fakes/NotificationFake::sentNotifications() (#43558)
  • Added implode to Passthru in Illuminate/Database/Eloquent/Builder.php (#43574)
  • Make Config repository macroable (#43598)
  • Add whenNull to ConditionallyLoadsAtrribute trait (#43600)
  • Extract child route model relationship name into a method (#43597)

Revert

Fixed

  • Fix unique locking on broadcast events (#43516)
  • Fixes the issue of running docs command on windows (#43566, #43585)
  • Fixes output when running db:seed or using --seed in migrate commands (#43593)

Changed

  • Gracefully fail when unable to locate expected binary on the system for artisan docs command (#43521)
  • Improve output for some Artisan commands (#43547)
  • Alternative database name in Postgres DSN, allow pgbouncer aliased databases to continue working on 9.x (#43542)
  • Allow @class() for component tags (#43140)
  • Attribute Cast Performance Improvements (#43554)
  • Queue worker daemon should also listen for SIGQUIT (#43607)
  • Keep original keys when using Collection->sortBy() with an array of sort operations (#43609)

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.

Laravel News Partners