fix(middleware): create missing PreventAccessFromTenantDomains middleware
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Successful in 55s
Koori-ERP-Deploy-System / deploy-production (push) Has been skipped

This commit is contained in:
2026-01-15 13:43:22 +08:00
parent a6b5496529
commit 9ce8ff4e06
2 changed files with 21 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Stancl\Tenancy\Tenancy;
class PreventAccessFromTenantDomains
{
public function handle(Request $request, Closure $next)
{
// 如果租戶已初始化 (代表是從租戶域名存取),則禁止訪問 Landlord 路由
if (tenancy()->initialized) {
abort(404);
}
return $next($request);
}
}

View File

@@ -14,7 +14,7 @@ use App\Http\Controllers\Landlord\TenantController;
| |
*/ */
Route::prefix('landlord')->name('landlord.')->middleware(['web', 'auth', \Stancl\Tenancy\Middleware\PreventAccessFromTenantDomains::class])->group(function () { Route::prefix('landlord')->name('landlord.')->middleware(['web', 'auth', \App\Http\Middleware\PreventAccessFromTenantDomains::class])->group(function () {
// 房東儀表板 // 房東儀表板
Route::get('/', [DashboardController::class, 'index'])->name('dashboard'); Route::get('/', [DashboardController::class, 'index'])->name('dashboard');