Back to Blog

Laravel 9.24 Released

Julian Beaujardin
Julian Beaujardin August 10th, 2022

The Laravel team released 9.24 with new artisan "db" commands, a new built-in validation rule, restoring soft-deleted models without any events, making a Config repository macroable 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.

Laravel 9.24

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

Laravel 9.24

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

Laravel 9.24

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:

// Validation passes $v = new Validator( $trans, ['x' => 'hello world'], ['x' => 'doesnt_end_with:hello'] ); $this->assertTrue($v->passes()); // Validation fails $v = new Validator( $trans, ['x' => 'hello world'], ['x' => 'doesnt_end_with:world'] ); $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.

$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:

config()->macro('sayHello', function () {
    return 'Hello, world';
});

config()->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

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)