DEV Community

Morcos Gad
Morcos Gad

Posted on

New in Laravel 8.80 - Route::controller()

A great thing has been added in Laravel 8.80, https://github.com/laravel/framework/pull/40276 which is the use of Route::controller() with Groups to shorten Route, so I want to share it with you so that you may use it in your next projects.

 Route::controller(PlacementController::class)->prefix('placements')->as('placements.')->group(function () {
    Route::get('', 'index')->name('index');
    Route::get('/bills', 'bills')->name('bills');
});
Enter fullscreen mode Exit fullscreen mode

Image description
I hope you enjoyed the code.

Top comments (2)

Collapse
 
lucidpolygon profile image
lucidpolygon

Read Taylor's tweet about this. Interesting addition to avoid repetition.

Collapse
 
morcosgad profile image
Morcos Gad

Thank you for your comment. I wanted to share it so that the largest number of interested people can benefit as much as I did.