Coder Social home page Coder Social logo

laravel-sidebar's People

Contributors

breaktag avatar czim avatar ferdousanam avatar frankpeters avatar komakino avatar maatwebsitesupport avatar mikemand avatar mvdstam avatar patrickbrouwers avatar pralhadstha avatar sdebacker avatar tonyrouse avatar wikigods avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-sidebar's Issues

isActiveWhen for dynamic routes

Couldn't find anything from the wiki.
Is there any ways to make single link active for multiple routes including one dynamic route with parameter ?
i.e: there isn't any menu item for edit link for a resource but I want to make the index or parent item active

LOG.warning: implements the Serializable interface

I'm getting LOG.warning: implements the Serializable interface using laravel 9 but I think it's more due to the PHP 8.1.2 version I'm currently using.

"Warning.
As of PHP 8.1.0, a class that implements Serializable without also implementing __serialize() and __unserialize() will generate a deprecation warning."

My solution is to implement __serialize() and __unserialize() , so as not to have that warning.

Screenshot_6
@patrickbrouwers

Release number ?

Thanks for this great package. I'm wondering if there will be a release soon, so we can avoid to have dev-master in composer.json ?

Using as navbar

Is it possible to use this plugin as a navigation bar instead of a sidebar?

Incorrect spacing of @if and @endif in resources/views/item.blade.php causes Parse Error

Hi, seems in that line 1 of item.blade.php :

<li class="@if($item->getItemClass()){{ $item->getItemClass() }}@endif @if($active)active@endif @if($item->hasItems())treeview@endif clearfix">

Causes the following error:

Parse error: syntax error, unexpected end of file, expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF)

Putting an extra space before the start of @endif seems to solve the problem, so line 1 should be:

<li class="@if($item->getItemClass()){{ $item->getItemClass() }}@endif @if($active)active @endif @if($item->hasItems())treeview @endif clearfix">

Seems that the Blade's @foobar directives must be "isolated" with a space before.

Composer update shows up class SidebarServiceProvider is not found

Hello there, i'm trying to run composer update, however, i keep getting this error:
`In Application.php line 690:

Class 'Maatwebsite\Sidebar\SidebarServiceProvi
der' not found`

This persists after i install this package

Edit: fixed this by installing several other required packages.

Using the package with Laravel 5.4 and Sentinel

Hello,
I've managed to load the sidebar, extend it and render it, all looks pretty awesome. I experienced some difficulty with using Sentinel inside SidebarExtenders to display some of the menus based on the permissions of the user. Unfortunately, when I try to access Sentinel it's always a empty object. I found that from Laravel 5.3 there is ะฐ change how classes are loaded and you can not access Auth (maybe Sentinel also) within __construct methods and while Laravel boots because actually there is still no real request. That's a problem because we load the sidebar using dependency injection inside the __construct method of our AdminController. So my questions are:

  1. Does this package supports using of Sentinel inside it for Laravel 5.4?
  2. Or can we somehow load the sidebar inside a middleware maybe? (Where Sentinel is available and works)

Thanks in advance.

Laravel 10 support :)

Hey, I noticed the composer.json doesn't allow laravel/framework 10 as of yet. Is this something you need help with? I reckon it's mainly adding ^10.0 to laravel/framework in composer.json :)

Item append not working properly

Situation:

I've got 2 items:

$item->addItem('posts', function (SidebarItem $item) {
    $item->weight = 0;
    $item->append('admin.blog.post.create');
    $item->route('admin.blog.post.index');
    $item->icon = 'fa fa-copy';
    $item->name = 'Posts';
    $item->authorize(
        $this->auth->hasAccess('blog.posts.index')
    );
});

$item->addItem('categories', function (SidebarItem $item) {
    $item->weight = 1;
    $item->route('admin.blog.category.index');
    $item->icon = 'fa fa-file-text';
    $item->name = 'Categories';
    $item->authorize(
        $this->auth->hasAccess('blog.categories.index')
    );
});

The plus gets appended to the categories item, not posts.

Decrease load time

The sidebar builder takes approx. 300ms to load the sidebar.
I have 12 menu items.

That is pretty much the same as the Laravel framework.

Maybe run it into a profiler or something, to find where there is a hog.

Sortable Items not working

The menu no longer sorts by weight, or at least I can't get it to. Is this by design in the revised version as I can't seem to find anywhere in the source code that it checks the weight attribute?

Laravel v8 support

Package cant install on Laravel 8 because of the versions in composer.json

Rendering sidebar in View composer

Quick question for anyone who may have an idea on this..

How do I render the sidebar using the view composer?

I am using teepluss/theme as my theme manager in my laravel projects. In the config file, the following code allows me to use view composer:

php
$theme->partialComposer('sidebar-bar', function($view)
{
$view->with('sidebar', '');
});

However, I am unsure of how to load the sidebar in the above code? Anyone have any ideas?

Thanks

Double borders issue

There some kind of 'bug' with the borders on the items, which makes it 'blurry':

screen_shot_2015-02-13_at_7_00_54_pm

sidebar build() dont work ?

I'm doing a project with laravel 5.1.12

I like adding a sidebar in the sample, but the build () function does not work in code.

SidebarViewCreator:

use Maatwebsite\Sidebar\Presentation\SidebarRenderer;
use Modules\Core\Sidebar\AdminSidebar;

class SidebarViewCreator
{
    /**
     * @var AdminSidebar
     */
    protected $sidebar;

    /**
     * @param AdminSidebar    $sidebar
     * @param SidebarRenderer $renderer
     */
    public function __construct(AdminSidebar $sidebar, SidebarRenderer $renderer)
    {
        $this->sidebar  = $sidebar;
        $this->renderer = $renderer;
    }

    public function create($view)
    {

        $view->sidebar = $this->renderer->render($this->sidebar);

    }
}

AdminSidebar

use Maatwebsite\Sidebar\Menu;
use Maatwebsite\Sidebar\Sidebar;

class AdminSidebar implements Sidebar
{
    /**
     * @var Menu
     */
    protected $menu;

    /**
     * @var RepositoryInterface
     */
    protected $modules;

    /**
     * @var Container
     */
    protected $container;

    /**
     * @param Menu                $menu
     * @param Container           $container
     */
    public function __construct(Menu $menu)
    {
        $this->menu = $menu;
    }

    /**
     * Build your sidebar implementation here
     */
    public function build()
    {
        $this->menu->group('settings', function (Group $group) {
            $group->item('User Settings');
        });
    }

    /**
     * @return Menu
     */
    public function getMenu()
    {
        return $this->menu;
    }
}

provider :

use Maatwebsite\Sidebar\SidebarManager;

class ModuleProvider extends ServiceProvider
{
    public function boot(SidebarManager $manager)
    {
        $manager->register('AdminSidebar::class);
    }
}

Using middleware ResolveSidebars with file store

Hello! ๐Ÿ˜„

I see I was missing the ResolveSidebars middleware after setting the cache option to static and the StaticCacheResolver wasn't called.

After having added the middleware, and for testing purposes changed the StaticCacheResolver to use the files cache disk, I'm getting:

Call to a member function make() on null (View: /Users/nicolaswidart/Sites/Asguard/Platform/Themes/Adminlte/views/layouts/master.blade.php) (View: /Users/nicolaswidart/Sites/Asguard/Platform/Themes/Adminlte/views/layouts/master.blade.php)
--

I'm not sure why it shows the view as location as there's isn't a make in there. The sidebar is sent to the view using a view creator

$view->sidebar = $this->renderer->render($this->sidebar);

Did I miss something for the static cache option to work?

Thanks!

Edit: What might also be something nice to have is to cache the views, reducing the number of partials loaded. The package is currently loading ~17 partials for the sidebar alone.

Cant inject dependency for Auth

Hi, am using this package with https://github.com/nWidart/laravel-modules . I want to use the default laravel 5.2* authentication yet i cannot get the user object which is always null when using dependency injection or even Request::user() or Auth::user()
See here:
`
class SidebarExtender implements \Maatwebsite\Sidebar\SidebarExtender {
public function __construct(Auth $auth){
$this->auth=$auth;
dd($this->auth);// null
}
public function extendWith(Menu $menu) {
$menu->group('Dashboard', function (Group $group) {
$group->item('Inventory', function (Item $item) {
$item->weight(11);
$item->icon('fa fa-barcode');
$item->item('Sent', function (Item $item) {
$item->icon('fa fa-share-square-o');
$item->route('messaging.sent');
});
$item->item('Contacts', function (Item $item) {
$item->icon('fa fa-volume-control-phone');
$item->route('messaging.contacts');
});
$item->item('Buy Airtime', function (Item $item) {
$item->icon('fa fa-money');
$item->route('messaging.topup');
});
});
});
return $menu;
}

}`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.