artkonekt / menu Goto Github PK
View Code? Open in Web Editor NEWLaravel Menu Component
License: MIT License
Laravel Menu Component
License: MIT License
Hi,
I installed your extension in my laravel9, I created service provide and registered it in app.php file, When I am trying to access the sidebar in my blade file its showing be error like
Below is the code of my service provider.
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use View;
//use Konekt\Menu;
class SidebarnavServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
View::composer('*', function($view)
{
$navbars= \Menu::create('sidebar_left'); // will be $mainMenu in views
$navbars->addItem('Home', '/');
$navbars->addItem('About', 'about');
$view->with('navbars', $navbars);
});
}
}
AND in my blade file I use the below code.
{{-- Render with the built in 'ul' renderer --}}
{!! $navbars->render('ul') !!}
{{--Or render items manually--}}
<nav>
@foreach($navbars->items as $item)
<div class="nav-link><a href="{{ $item->url }}">{{ $item->title }}</a></div>
@endforeach
</nav>
Can you please check and tell me where I am making the mistake?
Thanks,
Jarnail
I don't want to use links in some items. How can I do that?
$menu = Menu::create('main');
$menu->addItem('home', 'Home', '/');
$menu->addItem('section', 'Section Title', ['url' => false, 'class' => 'menu-section']); // example: [url => false]
$menu->addItem('about', 'About', '/about');
<ul>
<li class="active"><a href="http://yourdomain.com">Home</a></li>
<li class="menu-section">
<h4 class="menu-text">Section Title</h4>
</li>
<li><a href="http://yourdomain.com/about">About</a></li>
</ul>
Hi there!
Are there any plan to update to Laravel 9? Its the only package which is left on our system to update to Laravel 9.
Cheers,
Tobias
Declaration of Konekt\Menu\ItemCollection::add(Konekt\Menu\Item $item) should be compatible with Illuminate\Support\Collection::add($item)
This error occurs on installation of https://github.com/vanilophp/framework
Please see vanilophp/framework#39
Maybe it's because of differente laravel/framework version.
I trying to merge some attr to links when is active, but don't work. How is possible make that.
$backendSideBarMenu = Menu::create('backendSideBarMenu', [
'auto_activate' => true,
'active_class' => 'shadow-soft-xl rounded-lg bg-white font-semibold text-slate-700',
'active_element' => 'link',
]);
$backendSideBarMenu->attr('class', 'flex flex-col pl-0 mb-0');
$backendSideBarMenu->addItem('dashboard', __('Dashboard'), '/dashboard')->activateOnUrls('dashboard');
$backendSideBarMenu->addItem('management', __('Management'), '/management')->activateOnUrls('management/*');
$backendSideBarMenu->items->roots()->attr('class', 'mt-0.5 w-full');
foreach ($backendSideBarMenu->items->roots() as $item) {
$item->link->attr('class', 'py-2.7 text-size-sm ease-nav-brand my-0 mx-4 flex items-center whitespace-nowrap px-4 transition-colors');
}
The active link only have the normal class py-2.7 ...
when have to by shadow-soft-... py-2.7 ...
Best Regards.
Yoinier.
I'm trying to create a dynamic menu by modules. But when i use the route name says that is not exists. I'm register menus in a service provider inside a module.
There is a way that I can use with both?
Hi there!
Are there any plan to update to Laravel 10? Its the only package which is left on our system to update to Laravel 10.
Cheers,
Tobias
hi
How do I access attributes:protected?
[attributes:protected] => Array
(
[icon] => bi bi-grid-fill
[class] => has-sub
)
$sidebar = Menu::create('sidebar', ['share' => 'sidebar']);
$sidebar->addItem('Login', 'Login',['url' => 'login', 'icon' => 'bi bi-grid-fill','class' => 'has-sub']);
@foreach($sidebar->items as $item)
<li class="sidebar-item ">
<a href="{{ $item->url }}" class='sidebar-link {{ $item->class }}'>
<i class="{{ $item->icon }}"></i>
<span>{{ $item->title }}</span>
</a>
</li>
@endforeach
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.