fix: handle tenant branding and Inertia selection redirects

This commit is contained in:
MeghdadFadaee committed 2026-09-09 21:15:31 +03:30
1 parent f62103d44b
commit eec91ac8e5
3 files changed
+39 -3

No files matched your search

+12 -1
View File
@@ -17,6 +17,12 @@ class TenantNotSelected extends RuntimeException implements Responsable
public function toResponse($request): Response
{
$destination = $this->selectorUrl();
if ($request instanceof Request && $request->header('X-Inertia') === 'true') {
return redirect()->to($destination);
}
if ($request instanceof Request && $request->expectsJson()) {
return response()->json([
'message' => $this->getMessage(),
@@ -24,9 +30,14 @@ class TenantNotSelected extends RuntimeException implements Responsable
], 409);
}
return redirect()->to($destination);
}
protected function selectorUrl(): string
{
$novaPath = '/'.trim(Nova::path(), '/');
$toolPath = trim((string) config('nova-tenancy.routes.uri', 'nova-tenancy'), '/');
return redirect()->to("{$novaPath}/{$toolPath}");
return "{$novaPath}/{$toolPath}";
}
}