/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if ($this->session->has($this->sessionKey)) { $this->googleTagManager->set($this->session->get($this->sessionKey)); } $response = $next($request); $this->session->flash($this->sessionKey, $this->googleTagManager->getFlashData()); return $response; }