code: public function terminate($request, $response)
      {
          if ($this->sessionConfigured()){
              $session = $request->getSession();
              if (!empty($session) && method_exists($session, 'save')){
                  $session->save();
              }
              unset($session);
          }
      }
docs: 执行请求生命周期的任何最终操作。
  Perform any final actions for the request lifecycle.
  
  @param  \Illuminate\Http\Request  $request
  @param  \Symfony\Component\HttpFoundation\Response  $response
  @return void