<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

class SetTenantMiddleware
{
    public function handle(Request $request, Closure $next)
    {
        if (auth()->check()) {
            setPermissionsTeamId(auth()->user()->current_escola_id);
        } else {
            setPermissionsTeamId(null);
        }

        return $next($request);
    }
}
