带有一个Laravel安装的多个网站 [英] Multiple websites with one Laravel installation
本文介绍了带有一个Laravel安装的多个网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
最初,我将安装Laravel并将其设置为一个名为admin.example.com的新网站.这将是一个简单的仪表板,仅供我使用.接下来,我要设置具有电子商务,库存控制,用户管理等所有功能的www.example1.com.一旦启动并运行,我将设置www.example2.com.
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?
推荐答案
您应使用路由组和 domain
属性:
You should use route groups and domain
property for that:
Route::group(['domain' => 'example.com')], function () {
// All routes for the first domain go here.
}
这篇关于带有一个Laravel安装的多个网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文