<?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);
    }
}
