Jess McKenzie
Jess McKenzie

Reputation: 8385

Sub Domain Routes and Controllers

I am new to laravel and I am wondering is there a way to do this?

How could I make my subdomain load a specific laravel route/controller?

Upvotes: 1

Views: 45

Answers (1)

whoan
whoan

Reputation: 8521

It's all in the official docs:

The sub-domain may be specified using the domain key on the group attribute array:

And the way to do it is as follows:

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

Upvotes: 1

Related Questions