D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
dateitor
/
public_html
/
vendor
/
stancl
/
tenancy
/
src
/
Middleware
/
Filename :
PreventAccessFromCentralDomains.php
back
Copy
<?php declare(strict_types=1); namespace Stancl\Tenancy\Middleware; use Closure; use Illuminate\Http\Request; class PreventAccessFromCentralDomains { /** * Set this property if you want to customize the on-fail behavior. * * @var callable|null */ public static $abortRequest; public function handle(Request $request, Closure $next) { if (in_array($request->getHost(), config('tenancy.central_domains'))) { $abortRequest = static::$abortRequest ?? function () { abort(404); }; return $abortRequest($request, $next); } return $next($request); } }