【发布时间】:2016-02-10 22:39:09
【问题描述】:
您好,我的数据库中有 7 个表,
所有 6 个表都有来自用户表的 user_id,
在用户模型中,我声明 hasOne 关系如下
public function profiledetailsHasOne()
{
return $this->hasOne('App\Profiledetails');
}
public function educationHasOne()
{
return $this->hasOne('App\Education');
}
public function occupationHasOne()
{
return $this->hasOne('App\Occupation');
}
public function maritalHasOne()
{
return $this->hasOne('App\Marital');
}
public function parentHasOne(){
return $this->hasOne('App\Parent');
}
我想知道除了使用这种集群方式之外,还有其他方法吗?
提前致谢
【问题讨论】:
标签: model eloquent laravel-5.2 has-one