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

hasOne() 공개 메소드

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