Filament routing

I am builing a multi tenant app using "tenancy for laravel" and I want to have an admin panel (using filament) on my central domain to manage all tentants information. The filament route would be "central.domain/admin" If a tenant tries to access "tenant.central.domain/admin", a 404 should be shown. I managed to get this working simply by changing : $domains = $panel->getDomains(); to $domains = config('tenancy.central_domains'); On filaments vendor/filament/routes/web.php However, I am guessing that breaks filaments native multi tenancy which i probably wont use but I'd like to keep things as clean as possible
1 Reply
(--')pwD
(--')pwDOP3w ago
I think I figured it out. I added a middleware, as you suggested to filaments AdminPanelProvider.php. That middleware checks if the host I'm accessing is present on the central domains. If not, a 403 is shown.
public function handle(Request $request, Closure $next): Response
{
$centralDomains = config('tenancy.central_domains');

if (! in_array($request->getHost(), $centralDomains)) {
abort(403, 'Unauthorized access to the admin area.');
}

return $next($request);
}
public function handle(Request $request, Closure $next): Response
{
$centralDomains = config('tenancy.central_domains');

if (! in_array($request->getHost(), $centralDomains)) {
abort(403, 'Unauthorized access to the admin area.');
}

return $next($request);
}
Want results from more Discord servers?
Add your server