Route Groups: Sub-Domain Routing

Sub-Domain Routing

Route::domain('{account}.myapp.com')->group(function () {
    Route::get('user/{id}', function ($account, $id) {
        //
    });
});

The sub-domain may be specified by calling the domain method before defining the group.

Sub-domains may be assigned route parameters just like route URIs, allowing you to capture a portion of the sub-domain for usage in your route or controller.

Route Groups: Sub-Domain Routing — Structure map

Clickable & Draggable!

Route Groups: Sub-Domain Routing — Related pages: