Set up relations with additional information #431
-
Hello everyone, currently I'm working on a hobby game project. I use Backpack as my "engine" where I set up all necessary data for the game. Like: NPCs, Items, Quests, Skills and so on. Sometimes I have the case that something has a "requirement". For example: To learn "Skill B" you have to have "Skill A" at least at level 5. Or: To be able to use "Item A" you need to train "Skill C" to at least level 3. With Backpack it is no problem to set up relations between all the models. But is it also possible somehow to add additional information to a relation? So when I select the related item I would be able to add additional information to this specific relation. As far as I know it is possible with Laravel to add additional columns to a pivot table for a hasMany || belongsToMany table. I'm curious if this can be handled out of the box or if I have to make some custom logic :) Kind regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @Alexander-Hagemeier This is achievable using relationship field type, which is a part of PRO Package. Here is the docs link pointing to the section which would help you save additional info. You can also check the similar use case in demo. Please follow the this demo link and go to relationship tab. Here you will find the field highlighted in following image which does the same: You can check the code of working example in Demo Repo & the Direct link to the field definition. |
Beta Was this translation helpful? Give feedback.
Hi @Alexander-Hagemeier
This is achievable using relationship field type, which is a part of PRO Package. Here is the docs link pointing to the section which would help you save additional info.
You can also check the similar use case in demo. Please follow the this demo link and go to relationship tab.
Here you will find the field highlighted in following image which does the same:
You can check the code of working example in Demo Repo & the Direct link to the field definition.