Laravel 5.7.26 Released
Published on by Paul Redmond
The Laravel team released Laravel 5.7.26 yesterday with a new pipeline method and a method to temporarily bypass model events.
First, a new Pipeline method thenReturn
was added by Tim MacDonald to allow additional work do be done on the object passed through:
// Previously$users = app(Pipeline::class) ->send(User::query()) ->through($pipes) ->then(function ($query) { return $query ->whereConfirmedEmail() ->whereAccountActive() ->get(); }); // As of 5.7.26 you can use `thenReturn()`$users = app(Pipeline::class) ->send(User::query()) ->through($pipes) ->thenReturn() ->whereConfirmedEmail() ->whereAccountActive() ->get();
Next, a few public getter methods were added:
Illuminate\Cache\TaggedCache::getTags();Illuminate\Http\ResponseTrait::getCallback();
License files were added to each Illuminate components since Laravel uses subtree splits for all the components:
Since we use a sub-split to split components into separate packages it’s wanted that we also provide a license file for each component.
A Model::withoutEvents()
method was added to temporarily bypass model events. A common use-case for this is testing:
$user = User::withoutEvents(function () { return factory(User::class)->create();}); $user->doSomethingWhereEventsShouldFire();
You can see the full list of changes below, and the whole diff between 5.7.25 and 5.7.26 on GitHub. The full release notes for Laravel 5.7 are available in the GitHub 5.7 changelog:
v5.7.26
Added
- Added
Illuminate\Pipeline\Pipeline::thenReturn()
(#27429) - Added
Illuminate\Cache\TaggedCache::getTags()
(#27445) - Added
Illuminate\Http\ResponseTrait::getCallback()
(#27464) - Added license file to each component (9e57e8b)
- Added
Model::withoutEvents()
method (#27419, 5c5d6b2)
Reverted
- Revert of “Fixed wrong class being used when eager loading nullable
MorphTo
withwithDefault()
(#27411)”(9bbf644)