The most practical database addition is DB::usingWritePdo(), which keeps reads on the write connection for the duration of a callback. Laravel restores the previous connection setting afterward, including when the callback throws an exception.
<?php
use Illuminate\Support\Facades\DB;
$posts = DB::usingWritePdo(
fn () => User::query()
->where('email', $email)
->first()
?->posts()
->whereNull('published_at')
->get()
);This addresses a subtle case in which a model is fetched through the write connection but a later relationship query switches to a replica. The method is useful for reading an order with its current status, checking inventory after an adjustment, or loading permissions after a role change.
The new PreventStaleDatabaseReads middleware handles read-after-write behavior across requests. After a write on the default connection, it records a timestamp in the session and routes that user's reads to the write connection for two seconds. A route group can use PreventStaleDatabaseReads::for(10) for a ten-second window. The feature needs a session, applies only to the user who made the write, and does not provide a general solution for stateless APIs. Applications with a single database connection do not need it.
Validation now permits float values in the where condition of Rule::unique(). A rule can therefore include a value such as 19.99 when uniqueness depends on both a SKU and a price. This does not replace a database constraint, so permanent multi-column uniqueness still belongs in an appropriate index.
Eloquent receives fixes for ofMany() aliases inside closures and for aggregate queries involving self-referencing one-of-many relationships. These cases affect relations that select one record by a criterion such as the latest effective price or current status. Projects that rely on these definitions should add regression coverage before upgrading.
The lazy() and lazyById() iterators now release the previous chunk as processing advances. That reduces retained memory for large exports, inventory updates, historical processing, background jobs, and migration scripts. It does not guarantee constant memory usage if application code stores every processed model.
Unique-job handling now releases its cache lock if dispatching a scheduled job fails. Without that cleanup, later dispatches can remain blocked. The change matters for scheduled reports, external synchronizations, and imports. Failure paths should be tested against the application's queue and cache configuration.
Additional fixes cover float results from collection mode(), date comparison validation with non-date values, and SQLite schema changes involving foreign keys or quoted table names. Laravel also corrects skipped unique broadcast jobs, counts unexpected worker crashes as exceptions for opted-in queued listeners, mailables, and notifications, and improves route caching when health routes are generated on one machine and used on another. Relation cloning and database query behavior receive further corrections.
For an upgrade, check the installed version with php artisan --version and inspect the framework constraint with composer show laravel/framework. Update the dependency with composer update laravel/framework, review compatibility for related packages, and run php artisan test. Test immediate reads after writes, relationship loading, APIs without sessions, scheduled-job lock failures, large lazy() or lazyById() workloads, and ofMany() queries. Deploy through the normal staging process, then watch query behavior, queue failures, and application logs. The official Laravel framework release notes, Laravel News overview, and Laravel 13.x documentation provide the referenced upgrade material.




Comments
No comments yet — be the first.
Open the discussion
No account or password needed — just enter your e-mail and we’ll send you a one-time sign-in link. First time here? You’re set up automatically.
Your rating will be applied automatically after you sign in.
Check your inbox
We’ve sent a sign-in link to …. Open it on this device — this tab will sign you in automatically.
Nothing arrived? Check your spam folder — and mark the mail as "Not spam" so it lands in your inbox next time.