在Laravel中使用Modle usin Algolia从scoutKey生成ID的附加模型路径

Scout Extended的最新功能非常出色,可以在laravel中使用Algolia Search API。但是用scoutKey保存模型路径的值是一种不好的方法。

在加密时,它在ObjectIdEncrypter类中使用以下内容:

public static function encrypt($searchable,int $part = null): string
{
    $scoutKey = method_exists($searchable,'getScoutKey') ? $searchable->getScoutKey() : $searchable->getKey();

    $meta = [get_class($searchable->getModel()),$scoutKey];

    if ($part !== null) {
        $meta[] = $part;
    }

    return implode(self::$separator,$meta);
}

因此,objectID的导入方式如下:objectID: {ModelPath}::scoutKey

导入和搜索结果中的

还会显示一个包含模型路径的字符串。 任何人都可以在这件事上提供帮助。

fls757126991 回答:在Laravel中使用Modle usin Algolia从scoutKey生成ID的附加模型路径

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3168103.html

大家都在问