您好,在我的项目中,我使用 VentureCraft/revisionable https://github.com/VentureCraft/revisionable这是记录数据库中记录更改历史的补充。一切正常,但是当我在页面上返回历史记录时,脚本以 id 的形式返回结果。这是我的表“products” products_table这是表“revisions” revisions_table此表连接到表:文章、用户和类别。现在历史更改如下所示:
“用户 1 将姓名文章从 2 更改为 1”
我希望历史更改看起来像:
“用户 JACK 将名称文章从 SHOES 更改为 BALL”
我尝试使用此链接。
带有文件 Revisionable.php 的方法 identifiableName() 如下所示:
public function identifiableName()
{
return $this->getKey();
}
在模型 product.php 中,我添加了:
public function identifiableName(){
return $this->article_name;
}
或这个:
public function identifiableName(){
return $this->article()->article_name;
}
但它不起作用。