Menu & Sidebar
The sidebar (and optional top-nav) is driven entirely by the menu array in config/adminlte.php. Each element is a single menu item. Items pass through a filter pipeline that resolves URLs, computes the active state, and hides items the current user is not authorized to see.
A real menu example
'menu' => [
['header' => 'MAIN'],
[
'text' => 'Dashboard',
'route' => 'dashboard',
'icon' => 'bi bi-speedometer',
],
// External link, opens in a new tab
[
'text' => 'Users',
'url' => 'admin/users',
'icon' => 'bi bi-people',
'can' => 'view-users',
'label' => 5,
'label_color' => 'danger',
],
['header' => 'CONTENT'],
// Treeview (collapsible submenu, nestable to any depth)
[
'text' => 'Posts',
'icon' => 'bi bi-file-post',
'submenu' => [
['text' => 'All posts', 'route' => 'posts.index', 'icon' => 'bi bi-circle'],
['text' => 'New post', 'route' => ['posts.edit', ['id' => 1]], 'icon' => 'bi bi-circle'],
],
],
],
Item keys
| Key | Purpose |
|---|---|
header | Renders a non-clickable section label (<li class="nav-header">) instead of a link. |
text | The visible link label (required for links). |
route | Named route. String, or [name, params] array — resolved with Laravel's route(). |
url | Raw URL (relative or absolute). External URLs (//, mailto:, tel:) are kept verbatim; others pass through url(). |
icon | Bootstrap Icons class (e.g. bi bi-speedometer). Defaults to bi bi-circle if omitted. |
icon_color | Adds text-{color} to the icon. |
label / label_color | Badge value after the text, with text-bg-{color} (defaults to primary). |
target | Anchor target (e.g. _blank); adds rel="noopener" automatically. |
can / can_params | Gate ability (string or array) required to display the item; can_params is the model/argument. |
active | URL pattern(s) that mark the item active (string or array of Request::is() patterns). |
submenu | Array of child items, rendered as a collapsible treeview (nestable to any depth). |
The filter pipeline
Filters are listed in config('adminlte.filters') and run in array order. Each implements ColorlibHQ\AdminLte\Menu\Filters\FilterInterface with transform(array $item): ?array — returning null drops the item.
| Order | Filter | Effect |
|---|---|---|
| 1 | GateFilter | Removes items the current user is not authorized to see (can). |
| 2 | HrefFilter | Resolves the final href from route / url. |
| 3 | ActiveFilter | Marks the active item / treeview branch. |
| 4 | SearchFilter | Normalizes navbar-search items (method, placeholder, url). |
Active-state behavior
- If
activeis a boolean it is respected as-is. - If
activeis a pattern (or list), the item is active when the request matches viaRequest::is(). - With no
activepattern, one is auto-derived fromurl: a URLadmin/usersmatches bothadmin/usersandadmin/users/*.'/'matches only the root;'#'never matches. - A treeview parent becomes active (and opens,
menu-open) when any descendant is active.
Scoped menus & runtime additions
Resolve the menu builder singleton via app('adminlte'). Place items in the topbar with topnav / topnav_right, or add items at runtime from a service provider's boot():
// Place an item in the right side of the topbar instead of the sidebar
['text' => 'Help', 'url' => 'help', 'icon' => 'bi bi-question-circle', 'topnav_right' => true];
// Insert after an item matching key/text/header
app('adminlte')->addAfter('Dashboard',
['header' => 'REPORTS'],
['text' => 'Sales', 'route' => 'reports.sales', 'icon' => 'bi bi-graph-up'],
);
// Or append to the end
app('adminlte')->add(
['text' => 'Status', 'url' => 'status', 'icon' => 'bi bi-activity'],
);
Give items an explicit 'key' => 'dashboard' when you want a stable anchor for addAfter() that survives text changes and translation. Runtime additions persist for the rest of the request and reset on the next one.