The Laravel team released v12.13.0, which includes naming queued closures, a new assertRedirectBack() test assertion, callback support for Collection's containsOneItem()
method, and more:
assertRedirectBack
Test Assertion
New Ryan Chandler contributed a new assertRedirectBack()
method that has been added to Laravel's test suite, making it easier to assert redirection to the intended “back” URL:
$response->assertRedirectBack();
This assertion adds clarity when testing flows involving redirect()->back()
, and helps simplify test expectations around browser-like behavior.
See Pull Request #55635 for details.
Naming Queued Closures
Will Rowe contributed the ability to assign a name to queued Closure
, making identifying and managing jobs in your queues and monitoring tools easier.
dispatch(function () { // ...})->name('custom name');
See Pull Request #55634 for details.
containsOneItem
Callback Support in Fernando Garcia contributed the ability to pass a Closure
to the Collection containsOneItem()
method. Passing a Closure
allows custom logic to determine whether exactly one item in the collection satisfies the condition:
$collection = collect([1, 2, 3]); $collection->containsOneItem(fn($item) => $item === 2); // true$collection->containsOneItem(fn($item) => $item > 1); // false (2 and 3 match)
See Pull Request #55622 for details.
Release notes
You can see the complete list of new features and updates below and the diff between 12.12.0 and 12.13.0 on GitHub. The following release notes are directly from the changelog:
v12.13.0
- [12.x] fix no arguments return type in request class by @olivernybroe in https://github.com/laravel/framework/pull/55631
- [12.x] Add support for callback evaluation in containsOneItem method by @fernandokbs in https://github.com/laravel/framework/pull/55622
- [12.x] add generics to aggregate related methods and properties by @taka-oyama in https://github.com/laravel/framework/pull/55628
- [12.x] Fix typo in PHPDoc by @AhmedAlaa4611 in https://github.com/laravel/framework/pull/55636
- [12.x] Allow naming queued closures by @willrowe in https://github.com/laravel/framework/pull/55634
- [12.x] Add
assertRedirectBack
assertion method by @ryangjchandler in https://github.com/laravel/framework/pull/55635 - [12.x] Typehints for bindings by @cosmastech in https://github.com/laravel/framework/pull/55633
- [12.x] add PHP Doc types to arrays for methods in Database\Grammar by @taka-oyama in https://github.com/laravel/framework/pull/55629
- fix trim null arg deprecation by @apreiml in https://github.com/laravel/framework/pull/55649
- [12.x] Support predis/predis 3.x by @gabrielrbarbosa in https://github.com/laravel/framework/pull/55641
- Bump vite from 5.4.18 to 5.4.19 in /src/Illuminate/Foundation/resources/exceptions/renderer by @dependabot in https://github.com/laravel/framework/pull/55655
- [12.x] Fix predis versions by @GrahamCampbell in https://github.com/laravel/framework/pull/55654
- [12.x] Bump minimum league/commonmark by @szepeviktor in https://github.com/laravel/framework/pull/55659
- [12.x] Fix typo in MemoizedStoreTest by @szepeviktor in https://github.com/laravel/framework/pull/55662
- [12.x] Queue event listeners with enum values by @wgriffioen in https://github.com/laravel/framework/pull/55656
- [12.x] Implement releaseAfter method in RateLimited middleware by @adamjgriffith in https://github.com/laravel/framework/pull/55671
- [12.x] Improve Cache Tests by @nuernbergerA in https://github.com/laravel/framework/pull/55670
- [12.x] Only pass model IDs to Eloquent
whereAttachedTo
method by @ashleyshenton in https://github.com/laravel/framework/pull/55666 - feat(bus): allow adding multiple jobs to chain by @dallyger in https://github.com/laravel/framework/pull/55668
- [12.x] add generics to QueryBuilder’s column related methods by @taka-oyama in https://github.com/laravel/framework/pull/55663