onFail function when no tenant is found for a given domain/subdomain. #390
andelwebsolutions
started this conversation in
Ideas
Replies: 1 comment
-
You can achieve this behavior by registering a renderable for the NoCurrentTenant in your \App\Exceptions\Handler class. // in app/Exceptions/Handler.php
// ...
use Spatie\Multitenancy\Exceptions\NoCurrentTenant;
use Illuminate\Support\Facades\Redirect;
// ...
public function register()
{
// ...
$this->renderable(function (NoCurrentTenant $nte) {
return Redirect::away('https://www.mymainwebsite.com/');
});
}
// ... See this phpsandbox file for a demonstration of how that's done. I returned a view there since I can't redirect an iframe, a limitation of phpsandbox.io, not Laravel. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I would like to request a feature to redirect to a "main" domain/website (a marketing website for example) if no tenant is found for a given (sub-)domain.
Currenlty this is not possible I believe. Preferably this would be a "onFail" function that we could implement on our TenantFinder class to redirect the user (or do something else).
Beta Was this translation helpful? Give feedback.
All reactions