bouncer = $bouncer; } /** * Set the proper Bouncer scope for the incoming request. * * @return mixed */ public function handle(Request $request, Closure $next): Response { $user = $request->user(); $tenantId = $request->header('company') ? $request->header('company') : $user->companies()->first()->id; $this->bouncer->scope()->to($tenantId); return $next($request); } }