Multiple websites with one Laravel installation

2019-06-08 14:24发布

问题:

Initially, I will install Laravel and set it up for a new website called admin.example.com. This will be a simple dashboard just for my use. Next I want to set up www.example1.com with all of the functionality for ecommerce, inventory control, user management, etc. Once that is up and running, I will set up www.example2.com.

Can all of these various websites share the same models, views, and controllers?

回答1:

You should use route groups and domain property for that:

Route::group(['domain' => 'example.com')], function () {
    // All routes for the first domain go here.
}