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
- [12.x] Fix file validation bypass with empty input field collisions by @crynobone in #62504
- [13.x] Add model retrieval helpers to form requests by @stevebauman in #62523
- [13.x] Pass
$optionsthroughcopyToDiskandmoveToDiskby @mrjavadseydi in #62524 - [13.x] Add lockForNoKeyUpdate() to the query builder by @alimorgaan in #62544
- [12.x] Only split and release from real release branches by @joetannenbaum in #62530
- [13.x] Only split and release from real release branches by @joetannenbaum in #62528
- [13.x] Improve ThrottleRequestsWithRedis by @JurianArie in #62534
- [13.x] feat: temporary upload use stream instead of whole content by @paul-thebaud in #62533
- [13.x] Use line log formatter during Cloud build and deploy phase by @avosalmon in #62526
- [13.x] Auth: Clear stale password hash when logging in a passwordless user by @inooid in #62532
- [13.x] Ensure UniqueJobSkipped event is dispatched by the Scheduler by @jackbayliss in #62480
- [13.x] Welcome whenTransactionRunsLongerThan by @jackbayliss in #62423
- [13.x] feat(support): allow manager default driver to be an enum by @calebdw in #62559
- [13.x] Compare array values strictly in JSON Schema enum and uniqueItems rules by @raghavji2050 in #62558
- [12.x] Compare JSON Schema uniqueItems scalars strictly by @raghavji2050 in #62557
- [13.x] Only walk each chunk once when resolving Vite imports by @negoziator in #62551
- [13.x] Supports for PHP 8.6 by @crynobone in #61771
- [13.x] Add --schema-only option to migrate and migrate:fresh by @jackbayliss in #62535
- [12.x] Improves GitHub Actions workflows by @crynobone in #62579
- Bump actions/setup-go from 7.0.0 to 7.1.0 in the github-actions group by @dependabot[bot] in #62584
- [13.x] Skip mocked database manager when disconnecting connections on teardown by @dmitrakovich in #62600
- [12.x] Fix attribute escaping in secured Markdown mail by @crynobone in #62597
- Fix queued collections with custom queueable IDs by @Gummibeer in #62598
- [12.x] Normalize numeric input consistently in validation rules by @pushpak1300 in #62589
- [12.x] Improve performance of distinct validation rule on large arrays by @pushpak1300 in #62594
- [13.x] Normalize numeric input consistently in validation rules by @pushpak1300 in #62590
- [13.x] Pass db command client options through the environment by @pushpak1300 in #62591
- [12.x] Pass db command client options through the environment by @pushpak1300 in #62592
- [13.x] Improve performance of distinct validation rule on large arrays by @pushpak1300 in #62593
- [13.x] Fix MySQL JSON whereNull with a binary connection collation by @cyppe in #62583
- [12.x] Backport TransformsRequest key byte limit by @irfanm96 in #62582
- [13.x] Ignore array input in FormRequest model() and modelOrFail() by @almontasser in #62576
- [12.x] Compare user IDs as strings in broadcasting routes stub by @raghavji2050 in #62569
- [13.x] Fix empty tooltip on exception trace frames by @octoper in #62564
- [13.x] Fix Enumerable::when() and unless() callback docblocks by @alies-dev in #62566
- [12.x] Fix trans_choice ignoring conditions after " | " by @raghavji2050 in #62562
- [13.x] Make the ChannelManager and NotificationFake classes conditionable by @kevinb1989 in #62568
- [12.x] Clear stale password hash when logging in a passwordless user by @raghavji2050 in #62561
- [13.x] Pipeline Redis cache writes and deletes by @riasvdv in #62618
- [13.x] Test against PostgreSQL 19 by @aligulzar729 in #62610
- [13.x] Add Esperanto, Estonian and Polish PostgreSQL full text languages by @aligulzar729 in #62609
- [13.x] Send scheduled task output to the Laravel Cloud log socket by @jradtilbrook in #62608
- Double Bump by @jasonmccreary in #62602
- [13.x] Compare JSON path values as text on SQLite in the DatabasePresenceVerifier by @almontasser in #62601