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, 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)

lucidpolygon profile image

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

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.