I have added a custom table PostCategories. Now I want a belongsToMany relation for Post and Category, since one post can have multiple categories and single category may belong to many posts. I want a pivot table to have the data stored with fields post_id and category_id. How do I do this?
If I understand you correctly, you will need to edit the BREAD options for the post table adding a new relation and setting the options in there. Your edit/add form will then either need to be modified to include the new field how you like, or it may appear under the 'extra fields' section on the form you get out of the box.
yep..i got it working.
Thanks :)
Is it possible to copy paste the related code? I have no idea how to modify the view to show it and how to store into the model. Thanks.
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.
Most helpful comment
If I understand you correctly, you will need to edit the BREAD options for the post table adding a new relation and setting the options in there. Your edit/add form will then either need to be modified to include the new field how you like, or it may appear under the 'extra fields' section on the form you get out of the box.