protected function relation($relation = null) { if (!is_null($relation)) { // 执行关联查询 return $this->db()->relation($relation); } // 获取关联对象实例 if (is_null($this->relation)) { $this->relation = new Relation($this); } return $this->relation; }