Laravel 7.8 Released

Laravel 7.8 Released

The Laravel team released v7.8.0 with new takeWhile and takeUntil collection methods, along with all the latest new features, fixes, and changes in the 7.x branch. Let’s look at a few new features released in 7.8:

Redirector Signed Routes

Ryan Chandler contributed shortcut methods for generating signed routes from the Redirector service:

// Example
redirect()->to(URL::signedRoute(...));

// Using `signedRoute` and `temporarySignedRoute`
redirect()->signedRoute($route, $parameters, $expiration, $status, $headers);

// and

redirect()->temporarySignedRoute($route, $expiration, $parameters, $status, $headers);

Use-cases for these new methods are relatively edge-case, and I would advise reading the discussion in the Pull Request before reaching for these methods.

The takeUntil and takeWhile Collection Methods

Joseph Silber contributed a takeUntil and takeWhile collection methods, also making them support lazy collections. The documentation has updated details about these two methods.

First, here’s some examples of using the takeUntil method (until is an alias of takeUntil with this release):

$collection = collect([1, 2, 3, 4]);

$subset = $collection->takeUntil(function ($item) {
    return $item >= 3;
});

$subset->all();
// [1, 2]

// Passing a primitive value
$subset = $collection->until(3);
$subset->all();
// [1, 2]

Next, here’s an example of takeWhile:

$collection = collect([1, 2, 3, 4]);

$subset = $collection->takeWhile(function ($item) {
    return $item < 3;
});

$subset->all();
// [1, 2]

Check out Pull request #32496 and #32494 for implementation details, and the updated collection documentation for usage examples.

Release Notes

While we didn’t look at all the new features in this post, you can see the full list of new features and updates below and the diff between 7.7.0 and 7.8.0 on GitHub. The full release notes for Laravel 7.x are available in the latest v7 changelog:

v7.8.0

Added

  • Added signedRoute() and temporarySignedRoute() methods to Illuminate\Routing\Redirector (#32489)
  • Added takeUntil and takeWhile collection methods (#32494, #32496)
  • Added Illuminate\Container\ContextualBindingBuilder::giveTagged() (#32514)
  • Added methods withFragment and withoutFragment to Illuminate\Http\RedirectResponse (11d6bef, 0099591, 42c67a1, a1e741a)
  • Added exclude_without validation rule (4083ae5)

Fixed

  • Fixed compiled route actions without a namespace (#32512)
  • Reset select bindings when setting select (#32531)

Changed

  • Added warn in Illuminate/Support/Facades/Auth::routes() when laravel/ui is not installed (#32482)
  • Added auth to each master on Illuminate\Redis\Connections\PhpRedisConnection::flushdb() (837921b)
  • Register opis key so it is not tied to a deferred service provider (Illuminate/Encryption/EncryptionServiceProvider.php) (62d8a07)
  • Pass status code to schedule finish (#32516)
  • Check route:list –columns option case insensitively (#32521)

Deprecated

  • Deprecate Illuminate\Support\Traits\EnumeratesValues::until (#32517)

Filed in: News / Laravel 7 / Releases
Laravel News Partners

Laravel Jobs

Senior Full Stack Engineer - Laravel
Remote
Givebutter
Laravel partner seeks Lead Developer
Remote
Kirschbaum Development Group
Senior Programmer **Immediate Opening** (send resume to daniel@sbgcorp.com)
Remote
SBG Corp
Web Developer - Laravel
Grand Forks, North Dakota
Center for Rural Health
Senior Full-Stack Laravel Developer
Berlin, Germany
felmo.de

Newsletter

Join 31,000+ others and never miss out on new tips, tutorials, and more.