datlechin / filament-menu-builder

Create and manage menu in your Filament app.
MIT License
55 stars 11 forks source link

Fix similar titles for menu items #29

Closed ghiath-dev closed 1 month ago

ghiath-dev commented 2 months ago

Adding key for the menu item to unique the items when same title is used.

While using your package and when adding items which having same title i noticed the following problems:

I fixed it by:

  1. Adding unique "key" column and attribute for the menu items to handle the difference.
  2. Add "getMenuPanelKeyColumn" function in the HasMenuPanel and HasMenuPanel Contracts.
  3. Modify the MenuPanel.php to form the items with key => title
  4. Filter items when adding by the new key column in ModelMenuPanel.php.

Hope i explained the issue and the fix clearly.

At the end, Thanks for sharing the package, It was useful.

datlechin commented 2 months ago

Does it break the existing app?

ghiath-dev commented 2 months ago

Sorry, I didn't understand what you mean?

It was not a break problem, but as i explained

datlechin commented 2 months ago

We may need write migration to generate key for existing menu items

ghiath-dev commented 2 months ago

I see.

So separate migration for adding the key column.