1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 17:44:04 +00:00

Make central route 404 in PreventAccess mw customizable

This commit is contained in:
Samuel Štancl 2020-04-25 01:30:27 +02:00
parent e363456497
commit 8e1cfa5ae0

View file

@ -13,6 +13,16 @@ use Illuminate\Support\Facades\Route as Router;
*/ */
class PreventAccessFromTenantDomains class PreventAccessFromTenantDomains
{ {
/** @var callable */
protected $central404;
public function __construct(callable $central404 = null)
{
$this->central404 = $central404 ?? function () {
return 404;
};
}
/** /**
* Handle an incoming request. * Handle an incoming request.
* *
@ -39,7 +49,7 @@ class PreventAccessFromTenantDomains
} }
if ($isExemptDomain && $isTenantRoute) { // accessing tenant routes on web domains if ($isExemptDomain && $isTenantRoute) { // accessing tenant routes on web domains
abort(404); return ($this->central404)($request, $next);
} }
return $next($request); return $next($request);