fix(routes): implementing universal routes to resolve 404 on central domain
This commit is contained in:
@@ -11,16 +11,13 @@ use Stancl\Tenancy\Middleware\PreventAccessFromCentralDomains;
|
||||
| Tenant Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 租戶專屬路由。當使用者透過租戶網域 (如 koori.koori-erp.test) 存取時,
|
||||
| 會自動初始化租戶 context 並連接到對應的租戶資料庫。
|
||||
| 租戶專屬路由。當使用者透過租戶網域存取時,會自動初始化租戶 context。
|
||||
|
|
||||
| 注意:目前 ERP 路由定義在 routes/web.php,這些路由在「所有」域名都可用。
|
||||
| 當請求來自租戶域名時,tenancy middleware 會自動切換到租戶資料庫。
|
||||
|
|
||||
*/
|
||||
|
||||
Route::middleware([
|
||||
'web',
|
||||
InitializeTenancyByDomain::class,
|
||||
PreventAccessFromCentralDomains::class,
|
||||
])->group(function () {
|
||||
// 載入與 central 相同的 ERP 路由,但運行在租戶資料庫 context 中
|
||||
require base_path('routes/web.php');
|
||||
});
|
||||
// 此處可以定義「僅」租戶可用的路由 (central domain 不可存取)
|
||||
// 目前不需要,因為 ERP 功能對 central 和 tenant 都開放
|
||||
|
||||
|
||||
Reference in New Issue
Block a user