论坛风格切换切换到宽版
  • 26阅读
  • 1回复

关联 [复制链接]

上一主题 下一主题
离线北斗星
 

只看楼主 倒序阅读 使用道具 楼主   发表于: 2019-05-04
离线北斗星

只看该作者 沙发   发表于: 2019-05-04
public function myhasOne($related, $foreignKey = null, $localKey = null, $table)
    {
        //$instance = $this->newRelatedInstance($related);
        $instance = (new $related)->setTable($table);

        $foreignKey = $foreignKey ?: $this->getForeignKey();

        $localKey = $localKey ?: $this->getKeyName();

        return $this->newHasOne($instance->newQuery(), $this, $instance->getTable().'.'.$foreignKey, $localKey);
    }
快速回复
限100 字节
如果您提交过一次失败了,可以用”恢复数据”来恢复帖子内容
 
上一个 下一个