Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

joshsalway's avatar

Adding Brands a User can see? eg. tags from database saved as pivot table

The feature is: A User can see only certain Brands and this is specified by Laravel Nova.

User UserBrand (pivot table) Brand

How would you use Laravel Nova to multi-select and edit a Users relationship to Brands?

Anyone have any suitable suggestions?

This package allows you to add multi-select fields to Laravel Nova: https://github.com/optimistdigital/nova-multiselect-field

However, it saves the data as JSON data. Is there any way to use the database to utilize the Pivot table and save the data accordingly or is that unreasonable?

0 likes
3 replies
joshsalway's avatar

With this package. It saves it as a JSON data into a Text, String or VarChar.

In order to keep the database the same.

This package saves the data like this:

| ID | user_id | brand_id | |----|:-------:|---------:| | 1 | 1 | [1,2] |

However, I need to save the data like so:

| ID | user_id | brand_id | |----|:-------:|---------:| | 1 | 1 | 1 | | 2 | 1 | 2 |

Any suggestions on how to do so?

Please or to participate in this conversation.