thedevdojo/voyager

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

Ouverte

#2 193 ouverte le 8 nov. 2017

 (2 commentaires) (5 réactions) (0 personne assignée)PHP (2 652 forks)batch import
help wantedopen for suggestionstype:enhancement

Métriques du dépôt

Stars
 (11 817 étoiles)
Métriques de merge PR
 (Métriques PR en attente)

Description

  • 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

Guide contributeur