Define a Route Group Controller in Laravel 8.80

https://laravelnews.imgix.net/images/laravel8.jpg?ixlib=php-3.3.1

The Laravel team released 8.80 with the ability to define a route group controller, render a string with the Blade compiler, PHPRedis serialization and compression config support, and the latest changes in the v8.x branch.

Specify a Route Group Controller

Luke Downing contributed the ability to define a controller for a route group, meaning you don’t have to repeat which controller a route uses if the group uses the same controller:

1Route::controller(PlacementController::class)

2 ->prefix('placements')

3 ->as('placements.')

4 ->group(function () {

5 Route::get('', 'index')->name('index');

6 Route::get('/bills', 'bills')->name('bills');

7 Route::get('/bills/{bill}/invoice/pdf', 'invoice')->name('pdf.invoice');

8 });

Render a String With Blade

Jason Beggs contributed a Blade::render() method that uses the Blade compiler to convert a string of Blade templating into a rendered string:

1// Returns 'Hello, Claire'

2Blade::render('Hello, ', ['name' => 'Claire']);

3 

4// Returns 'Foo '

5Blade::render('@if($foo) Foo @else Bar @endif', ['foo' => true]);

6 

7// It even supports components :)

8// Returns 'Hello, Taylor'

9Blade::render('<x-test name="Taylor" />');

PHPRedis Serialization and Compression Config Support

Petr Levtonov contributed the ability to configure PHPRedis serialization and compression options instead of needing to overwrite the service provider or define a custom driver.

The PR introduced the following serialization options:

  • NONE
  • PHP
  • JSON
  • IGBINARY
  • MSGPACK

And the following compressor options:

These options are now documented in the Redis – Laravel documentation.

Release Notes

You can see the complete list of new features and updates below and the diff between 8.79.0 and 8.80.0 on GitHub. The following release notes are directly from the changelog:

v8.80.0

Added

  • Allow enums as entity_type in morphs (#40375)
  • Added support for specifying a route group controller (#40276)
  • Added phpredis serialization and compression config support (#40282)
  • Added a BladeCompiler::render() method to render a string with Blade (#40425)
  • Added a method to sort keys in a collection using a callback (#40458)

Changed

  • Convert “/” in -e parameter to “” in Illuminate/Foundation/Console/ListenerMakeCommand (#40383)

Fixed

  • Throws an error upon make:policy if no model class is configured (#40348)
  • Fix forwarded call with named arguments in Illuminate/Filesystem/FilesystemAdapter (#40421)
  • Fix ‘strstr’ function usage based on its signature (#40457)

Laravel News