LMongo\Eloquent\Model::hasOne PHP Method

hasOne() public method

Define a one-to-one relationship.
public hasOne ( string $related, string $foreignKey = null ) : LMongo\Eloquent\Relation\HasOne
$related string
$foreignKey string
return 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