How To Define a Route Group Controller in Laravel 8.80

Share Your Love

Here I am describing the Laravel 8.80 route group, controller. The Laravel team released version 8.80, which includes the ability to define a route group controller, render a string with the Blade compiler, PHPRedis serialisation and compression config support, and the most current changes in the v8.x branch.

What we cover in this post,

Specify a Route Group Controller

The ability to define a controller for a route group was given by Luke Downing, which means you don’t have to repeat which controller a route uses if the group uses the same controller:

use App\Http\Controllers\OrderController;

Route::controller(OrderController::class)->group(function () {
    Route::get('/orders/{id}', 'show');
    Route::post('/orders', 'store');
});

In Laravel 8.80, a fantastic feature has been implemented,

Laravel Framework pull which is the use of Route::controller() with Groups to shorten Route, which I’d like to share with you so you may utilise it in your future projects.

Render a String With Blade

Jason Beggs contributed a mechanism called Blade::render(), which uses the Blade compiler to turn a string of Blade templating into a rendered string:

// Returns 'Hello, TechvBlogs'
Blade::render('Hello, {{ $name }}', ['name' => 'TechvBlogs']);
 
// Returns 'Foo '
Blade::render('@if($foo) Foo @else Bar @endif', ['foo' => true]);
 
// It even supports components :)
// Returns 'Hello, TechvBlogs'
Blade::render('<x-test name="TechvBlogs" />');

PHPRedis Serialization and Compression Config Help

Petr Levtonov offered the ability to tweak PHPRedis serialisation and compression options without having to rewrite the service provider or create a custom driver. The PR announced the following serialisation options:

  • NONE
  • PHP
  • JSON
  • IGBINARY
  • MSGPACK

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

Thank you for reading this blog.

Share Your Love
Default image
Lingaraj Senapati

Hey There! I am Lingaraj Senapati, the Co-founder of lingarajtechhub.com My skills are Freelance, Web Developer & Designer, Corporate Trainer, Digital Marketer & Youtuber.

Articles: 343

Newsletter Updates

Enter your email address below to subscribe to our newsletter