我正在尝试使用相同的模型/表配置关系,但Laravel会返回错误: timeout .
表:集合
-
id
-
collection_id
-
名字
-
说明
-
有效
-
时间戳......
型号/关系:收藏
/* ----------------------------------------------------------------------------
| Relationships
| -----------------------------------------------------------------------------
|
| Relacionamentos
|
*/
/**
* collection method
* Coleção pode pertencer a outra coleção
*
* @access public
* @return void
* @since 1.0
* @version 1.0
* @author Patrick Maciel
*/
public function collection()
{
return $this->belongsTo('Collection');
}
/**
* collections method
* Coleção pode ter várias sub-coleções
*
* @access public
* @return void
* @since 1.0
* @version 1.0
* @author Patrick Maciel
*/
public function collections()
{
return $this->hasMany('Collection');
}
错误
如何解决get get(parent)和collections(children)的问题?谢谢
1 回答
你尝试过hasOne而不是belongsTo吗?