News

Form Request Model Lookups and PHP 8.6 Support in Laravel 13.44

Published
Form Request Model Lookups and PHP 8.6 Support in Laravel 13.44 image

The Laravel team released v13.44.0 with form request model helpers, a Long-Running Transactions callback method, PHP 8.6 support, and more:

Model Lookups in Form Requests

Steve Bauman added the following model methods to form requests. They load Eloquent models from IDs in the request input:

$user = $request->model('user_id', User::class);       // User or null
$user = $request->modelOrFail('user_id', User::class); // User, or a ModelNotFoundException
$users = $request->models('user_ids', User::class);    // Eloquent collection

The model class is optional. Without it, Laravel guesses the class from the key, so user_id and user_ids both resolve to App\Models\User.

See #62523 and #62576 for more details.

Alerts for Long-Running Transactions

Jack Bayliss added a new method to database connections where you can define a callback when a transaction runs longer than an interval you provide:

use Carbon\CarbonInterval;
use Illuminate\Support\Facades\DB;

DB::whenTransactionRunsLongerThan(CarbonInterval::seconds(15), function ($connection, $event, $duration) {
    Log::warning("Transaction on [{$connection->getName()}] took {$duration}ms");
});

The callback runs after the outermost transaction commits or rolls back, and $event tells you which. A plain number is read as milliseconds, and nested transactions are not timed separately.

See #62423 for more details.

lockForNoKeyUpdate() for PostgreSQL

Ali Morgan added lockForNoKeyUpdate() to the query builder. On PostgreSQL, lockForUpdate() also blocks the lock a foreign key check takes, so while a parent row is locked, inserting a child row that references it waits, and two transactions can deadlock:

DB::transaction(function () use ($teamId) {
    $team = Team::whereKey($teamId)->lockForNoKeyUpdate()->first();

    // Inserting rows with a foreign key to this team is not blocked
});

MySQL, SQLite, and SQL Server use the same lock as lockForUpdate(), so the method is safe to call on any driver.

See #62544 for more details.

Load the Schema Dump Without Running Migrations

Jack Bayliss also added a --schema-only option to migrate and migrate:fresh. With it, Laravel loads the schema dump into a new database and skips the migrations that would normally run after it:

php artisan migrate:fresh --schema-only

This helps with connections whose migrations run separately, or not at all, in tests.

See #62535 for more details.

Options for copyToDisk() and moveToDisk()

Javad Seydi added an $options argument to copyToDisk() and moveToDisk(). You can now set visibility or S3 headers when moving a file from a local disk to S3:

Storage::disk('local')->moveToDisk('s3', 'tmp/report.pdf', 'reports/report.pdf', [
    'visibility' => 'private',
    'CacheControl' => 'max-age=31536000',
]);

Storage::disk('local')->copyToDisk('s3', 'exports/users.csv', options: 'public');

A string is treated as the visibility, the same as with put().

See #62524 for more details.

PHP 8.6 Support

Mior Muhammad Zaki fixed the deprecations Laravel triggered on PHP 8.6, including the deprecated SORT_LOCALE_STRING flag and strcoll() function, and a trimming issue in the validator.

See #61771 for more details.

Release Notes

You can see the complete list of new features and updates below and the diff between 13.43.0 and 13.44.0 on GitHub.

v13.44.0

Paul Redmond photo

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

Sponsored

laravelcloud logo
Laravel Cloud

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

Visit Laravel Cloud

The latest

View all →
Generate Laravel Validation Rules From a JSON Schema image

Generate Laravel Validation Rules From a JSON Schema

Read article
Laravel Suspicious Login: Detect and Block Risky Logins image

Laravel Suspicious Login: Detect and Block Risky Logins

Read article
Decide with Jev: Make Failed AI Requests Safe in Laravel image

Decide with Jev: Make Failed AI Requests Safe in Laravel

Read article
Black Friday: Learn the habits behind AI workflows that work image

Black Friday: Learn the habits behind AI workflows that work

Read article
Laravel Black Friday and Cyber Monday Deals 2026 image

Laravel Black Friday and Cyber Monday Deals 2026

Read article
pgjumbo: A PostgreSQL Client for macOS, Windows, and Linux image

pgjumbo: A PostgreSQL Client for macOS, Windows, and Linux

Read article