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

Crazylife's avatar

How to add dynamic label data to the adminlte side bar navigation without building menu?

Hi there, i want to count a dynamic data which get from database and display as label beside the navigation link. I am using this package jeroennoten/Laravel-AdminLTE.

 $usersCount = User::count();

        $event->menu->add('MAIN NAVIGATION');
        $event->menu->add([
            'text'        => 'Users',
            'url'         => 'admin/users',
            'icon'        => 'users',
            'label'       => $usersCount,
            'label_color' => 'success'
        ]);

I can do something like this using building menu, but most of my sidebar inside config/adminlte.php. Instead of using building menu to build my sidebar menu, is there any solution or trick to make it work without using building menu? Thanks.

0 likes
2 replies
MarianoMoreyra's avatar

Hi @crazylife

I also have most of my sidebar inside config/adminlte.php but I couldn't find a different way to achieve what you want.

Anyway, you don't have to move your entire menu to this runtime method. You just add the section / item that you want with dynamic label, at the end of the menu, or before / after with the other methods like addBefore($itemKey, ...$newItems) or addAfter($itemKey, ...$newItems)

Please or to participate in this conversation.