论坛风格切换切换到宽版
  • 12阅读
  • 0回复

setTable [复制链接]

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

只看楼主 倒序阅读 使用道具 楼主   发表于: 2019-01-12
public function detail()
{
return $this->myHasOne(Circle::class, 'group_id', 'group_id', 't_group_' . hashID($this->userid, 20));
}
  
public function myHasOne($related, $foreignKey = null, $localKey = null, $table)
{
$foreignKey = $foreignKey ?: $this->getForeignKey();
  
$instance = (new $related)->setTable($table);
  
$localKey = $localKey ?: $this->getKeyName();
  
return new HasOne($instance->newQuery(), $this, $instance->getTable() . '.' . $foreignKey, $localKey);
}
快速回复
限100 字节
如果您提交过一次失败了,可以用”恢复数据”来恢复帖子内容
 
上一个 下一个