News

Laravel 9.25 Released

Posted by I. B. Gd Pramana A. Putra, 20 Aug 22, last updated 20 Aug 22

Laravel's internal team has officially released version 9.25 which brought a couple of additional features and changes.

Model query touch() method to mass-update timestamps

Steve Bauman contributed a touch() method on eloquent query builder that enables you to touch model timestamps with or without query constraint.

// Mass updating the updated_at column
User::query()->touch();

// With query constraints
User::where('email', 'like', '%@company.com')->touch();

// Touching a specific column
Post::query()->touch('published_at');

Stringable "when not exactly"

Anjorin Damilare contributed whenNotExactly Stringable method that will execute a callback when a string is not a match with a given substring..

use Illuminate\Support\Str;
 
// Returns `Iron Man`
Str::of('Tony')
    ->whenNotExactly('Tony Stark', function ($stringable) {
        return 'Iron Man';
    }));
 
// Provide an optional default value if `false`
// Returns `Swing and a miss...!`
Str::of('Tony Stark')
    ->whenNotExactly('Tony Stark', function ($stringable) {
        return 'Iron Man';
    }, function ($stringable) {
        return 'Swing and a miss...!';
    }));

Release notes 9.25

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

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

Fixed

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

Changed

  • 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)

Reference: Laravel News

Answer & Responses
    No comments yet

Wanna write a response?

You have to login before write a comment to this post.