public function scopeOwns(Builder $query, Model $related, ?string $foreignKey = null): Builder
    {
        if (\is_null($foreignKey)) {
            $foreignKey = $this->getForeignKey();
        }

        return $query->where(
            $this->getKeyName(), $related->getAttribute($foreignKey)
        );
    }