27 lines
516 B
PHP
27 lines
516 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use App\Models\Tenant;
|
|
use Closure;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class TenanMiddleware
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param \Closure $next
|
|
* @return mixed
|
|
*/
|
|
public function handle($request, Closure $next)
|
|
{
|
|
if(Auth::check()) {
|
|
view()->share('user_tenants', Tenant::getTenantPerUser(Auth::id()));
|
|
}
|
|
|
|
|
|
return $next($request);
|
|
}
|
|
}
|