Home / Snippets / Nested Route Group in Laravel
Nested Route Group in Laravel cover

Nested Route Group in Laravel

395

3 years ago

0 comments

In Laravel you can nest route group, what that means is that you can create a group within a group. To achieve that you can define your route like below.
Route::group(['prefix' => 'hello'], function () {
    Route::group(['prefix' => 'world'], function () {
        Route::get('/', function () {
            return 'hello world';
        });
    });
});

So now you can access the route by entering "/hello/world" and get the "hello world" string back as response.
notion avatar

Alaz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this