Skip to main content

Menu notification badge

You can add a notification badge to the sidebar menu.

warning

Updating the notification value in the sidebar menu requires a full page refresh. This may change in the future.

Code example

In GlobalsController:

use Qore\System\Menu\MenuItem;

$group->addMenuItem('Something', '/something', function (MenuItem $item) {
$item->setNotificationCount(12);
});

Or in a resource:

use Qore\System\Resource\QoreResource;

use function Qore\Helpers\tenant_variable_value_or_throw;

class JobApplicationResource extends QoreResource {
public function notificationCount(): ?int
{
return $this->indexQuery()
->where('status_id', tenant_variable_value_or_throw('job_application_statuses', 'new')->id)
->count();
}
}

If both methods are used, then ->setNotificationCount will overwrite the count from notificationCount().

Preview