LMongo\Eloquent\Model::hasMany PHP 메소드

hasMany() 공개 메소드

Define a one-to-many relationship.
public hasMany ( string $related, string $foreignKey = null ) : HasMany
$related string
$foreignKey string
리턴 LMongo\Eloquent\Relations\HasMany
    public function hasMany($related, $foreignKey = null)
    {
        $foreignKey = $foreignKey ?: $this->getForeignKey();
        $instance = new $related();
        return new HasMany($instance->newQuery(), $this, $foreignKey);
    }
Model