0 votes
in Laravel by
What are route groups?

1 Answer

0 votes
by

Route Groups in laravel is used when we need to group route attributes like middlewares, prefixes, etc. we use route groups. It saves us a headache to put each attribute to each route.

Syntax:

Route::middleware(['throttleMiddleware'])->group(function () {

    Route::get('/', function () {

        // Uses throttleMiddleware

    });

    Route::get('/user/profile', function () {

        // Uses throttleMiddleware

    });

});

Related questions

0 votes
0 votes
0 votes
0 votes
asked Oct 17, 2023 in Laravel by Robindeniel
0 votes
asked Oct 17, 2023 in Laravel by Robindeniel
0 votes
asked Nov 15, 2023 in Azure by Robin
...