Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Menu Laravel Package

spatie/menu

Fluent, extensible menu builder for Laravel. Compose navigation with a clean API, render as HTML, and customize output via presenters and macros. Supports active state handling, links, submenus, and easy integration with Blade and your app’s routing.

View on GitHub
Deep Wiki
Context7

title: Conditional Items Based on Permissions weight: 3

v1.1+

The add method and all convenience methods (link, html, action,...) have an equivalent method with an IfCan suffix. When used, the item will only be added if the currently logged in user has a certain permission.

Menu::new()
    ->link('/', 'Home')
    ->linkIfCan('view-posts', '/posts', 'Posts');
<!-- User isn't logged in or can't view posts -->
<ul>
    <li><a href="/">Home</a></li>
</ul>
<!-- User is logged in and can view posts -->
<ul>
    <li><a href="/">Home</a></li>
    <li><a href="/posts">Posts</a></li>
</ul>

If your permission check requires parameters, you can provide an array for the permission. The permission's name should be the first element, and parameters should fill up the rest.

Menu::new()
    ->link('PostController@show', 'View post')
    ->linkIfCan(['edit-post', $post], 'PostController@edit', 'Edit post');
<!-- User isn't logged in or can't edit the post -->
<ul>
    <li><a href="/posts/1">View post</a></li>
</ul>
<!-- User is logged in and can edit the post -->
<ul>
    <li><a href="/posts/1">View post</a></li>
    <li><a href="/posts/1/edit">Edit post</a></li>
</ul>
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle