laravel 自定义 检查 session 数据是否存在

// vendor/laravel/framework/src/Illuminate/Session/Store.php
// 添加下面方法,而后在须要的地方,Session::hasSession()
     public function hasSession(){
         return $this->handler->read($this->getId()) ? true : false;
     }

//
 public function resetId($id)
    {
        $this->flush();
        $this->id = $id;
        if($this->hasSession()){
            $this->loadSession();
        }
   }