1

我有以下基本课程设置:

class Document extends Eloquent {

    /**
     * [types description]
     * @return [type] [description]
     */
    public function types() {
        return $this->belongsToMany('Type');
    }

}

什么值适合放在返回类型文档块中?执行返回方法的 var 转储指向对象 \Illuminate\Database\Eloquent\Relations\BelongsToMany

在这种情况下是否正确?(我不确定为什么会这样?)

谢谢

4

2 回答 2

6

相同的 Laravel 正在使用:

@return \Illuminate\Database\Eloquent\Relations\BelongsToMany

看一下文件

vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php
于 2013-07-31T18:38:08.680 回答
1

array它在最基本的层次上返回一个......虽然我只是称它为Relationship......因为这有点自我解释,这就是 Laravel 在其 docblock 中所说的

class Document extends Eloquent {

/**
 * [types description]
 * @return Relationship 
 */
public function types() {
    return $this->belongsToMany('Type');
}

}
于 2013-07-31T18:40:23.513 回答