Laravel 9.25 Released

Published on by

Laravel 9.25 Released image

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:

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...!';
}));

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

// 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');

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:

v9.25.0

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 deprication 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)
Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Laravel Forge

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Forge
Laravel Forge logo

Laravel Forge

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Forge
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $7500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $2500/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Lucky Media logo

Lucky Media

Bespoke software solutions built for your business. We ♥ Laravel

Lucky Media
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
LaraJobs logo

LaraJobs

The official Laravel job board

LaraJobs
Larafast: Laravel SaaS Starter Kit logo

Larafast: Laravel SaaS Starter Kit

Larafast is a Laravel SaaS Starter Kit with ready-to-go features for Payments, Auth, Admin, Blog, SEO, and beautiful themes. Available with VILT and TALL stacks.

Larafast: Laravel SaaS Starter Kit
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Rector logo

Rector

Your partner for seamless Laravel upgrades, cutting costs, and accelerating innovation for successful companies

Rector

The latest

View all →
Microsoft Clarity Integration for Laravel image

Microsoft Clarity Integration for Laravel

Read article
Apply Dynamic Filters to Eloquent Models with the Filterable Package image

Apply Dynamic Filters to Eloquent Models with the Filterable Package

Read article
Property Hooks Get Closer to Becoming a Reality in PHP 8.4 image

Property Hooks Get Closer to Becoming a Reality in PHP 8.4

Read article
Asserting Exceptions in Laravel Tests image

Asserting Exceptions in Laravel Tests

Read article
Reversible Form Prompts and a New Exceptions Facade in Laravel 11.4 image

Reversible Form Prompts and a New Exceptions Facade in Laravel 11.4

Read article
Basset is an alternative way to load CSS & JS assets image

Basset is an alternative way to load CSS & JS assets

Read article