Laravel 9.25 Released


August 17th, 2022

Laravel 9.25 Released

The Laravel team released 9.25 with a new string method, mass updating model timestamps with the query builder, and more:

Stringable "when not exactly"

Anjorin Damilare contributed a whenNotExactly string method that will execute a given callback if the string is not an exact match with the given value:

1use Illuminate\Support\Str;
3// Returns `Iron Man`
5 ->whenNotExactly('Tony Stark', function ($stringable) {
6 return 'Iron Man';
7 }));
9// Provide an optional default value if `false`
10// Returns `Swing and a miss...!`
11Str::of('Tony Stark')
12 ->whenNotExactly('Tony Stark', function ($stringable) {
13 return 'Iron Man';
14 }, function ($stringable) {
15 return 'Swing and a miss...!';
16 }));

Model query touch() method to mass-update timestamps

Steve Bauman contributed a touch() method to the model query builder, which allows you to touch a model's timestamp with or without query constraints. It behaves like Model::touch():

1// Mass updating the updated_at column
4// With query constraints
5User::where('email', 'like', '')->touch();
7// Touching a specific column

Release notes

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



  • Added whenNotExactly to Stringable (#43700)
  • Added ability to Model::query()->touch() to mass update timestamps (#43665)


  • Prevent error in db/model commands when using unsupported columns (#43635)
  • Fixes ensureDependenciesExist runtime error (#43626)
  • Null value for auto-cast field caused deprication warning in php 8.1 (#43706)
  • db:table command properly handle table who doesn't exist (#43669)


  • Handle assoc mode within db commands (#43636)
  • Allow chunkById on Arrays, as well as Models (#43666)
  • Allow for int value parameters to whereMonth() and whereDay() (#43668)
  • Cleaning up old if-else statement (#43712)
  • Ensure correct 'integrity' value is used for css assets (#43714)

Filed in:

Paul Redmond

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