Nested menu items for each menu #1298
Replies: 2 comments 1 reply
-
Yes, Backpack does provide functionality for nested menu items with reordering capabilities. This can be achieved using the Reorder Operation, which allows for both reordering and nesting of entries. Here's how you can implement this for your Menu and MenuItems models:
use \Backpack\CRUD\app\Http\Controllers\Operations\ReorderOperation;
protected function setupReorderOperation()
{
CRUD::set('reorder.label', 'name'); // replace 'name' with the field you want to show
CRUD::set('reorder.max_level', 3); // set the maximum nesting level
}
public function children()
{
return $this->hasMany(self::class, 'parent_id');
} This setup will allow you to reorder and nest menu items for each menu. For more detailed information on setting up and using the Reorder Operation, you can refer to the Reorder Operation documentation. If you need to display these nested menu items in your application, you can use Backpack's menu components. As of version 6.2+, Backpack supports multi-level menu dropdowns. You can create nested menu dropdowns by using the For example: <x-backpack::menu-dropdown title="Parent Menu" icon="la la-group">
<x-backpack::menu-dropdown-item title="Child Item 1" />
<x-backpack::menu-dropdown title="Nested Menu" icon="la la-question" nested="true">
<x-backpack::menu-dropdown-item title="Nested Child Item 1" />
<x-backpack::menu-dropdown-item title="Nested Child Item 2" />
</x-backpack::menu-dropdown>
</x-backpack::menu-dropdown> For more information on creating nested menu dropdowns, you can check the Base Components documentation. ℹ️ Please note our AI Bot does not reply to follow-ups, this will be the only AI answer in this thread. If the AI helped you find the answer, please mark it as answered or write details below so it can learn. Then close the conversation. If not, please give more information for when a human reads this. ℹ️ Relevant sources: Github Issue (closed): [Feature][3.4] Set initial CrudPanel properties on CrudController |
Beta Was this translation helpful? Give feedback.
-
Hello @nazar-goyda Do you have a change to check our Addon MenuCRUD Let me know if thats work for you. Cheers. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello guys. Do we have a feature like a nested menu? For example, I have a Menu model and a MenuItems model (relationship 1-n). This means I can have many menus, and each menu can have many menu items. Can we create nested menu items for each menu (with sortable, like reorder functionality)? I wanted to have this ability in create/update pages. Because in CRUD I'm working with Menu model only. Menu items I added with subfields Maybe we already have this feature.
Beta Was this translation helpful? Give feedback.
All reactions