thedevdojo/voyager

No Belongs-To-Many relation to current model in BREAD

开放

#2,193 创建于 2017年11月8日

 (2 条评论) (5 个反应) (0 位负责人)PHP (2,652 个派生)batch import
help wantedopen for suggestionstype:enhancement

仓库指标

星标
 (11,817 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

  • Laravel Version: 5.5.20
  • Voyager Version: 1.0
  • PHP Version: 7.1.8
  • Database Driver & Version: MySQL 5.6.35

Description:

I would like to create a "belongs-to-many" relation from article to article which is called "related articles".

When I try to do this I can choose a pivot table but the system automatically chooses the keys for the relation. In this case it tries to use twice article_id as keys which is obviously not possible.

The fix would be to allow users to customize the key names which should be used inside of the pivot.

Steps To Reproduce:

  • Create a database table "test"
  • Create a database table "related_tests" with test_id and related_id as columns
  • Create a bread for this table
  • Add relationship
  • Choose belongs to many with test as target
  • Choose related_tests as pivot

贡献者指南