Posts Learn Components Snippets Categories Tags Tools About

Nested Route Group in Laravel

Learn how to define nested route group in Laravel and simplify your code.

Created on Jul 12, 2021


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.

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

Load comments for Nested Route Group in Laravel