Giter Club home page Giter Club logo

menus's People

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

menus's Issues

Error package:discover !

Hi, @pingpong-labs I have some problem with your package on Laravel version 5.8.
I can't discover your packages. I add in config/app.php your class MenusServiceProvider an alias for a package. But after call php artisan vendor:publish I get next error from composer:

Symfony\Component\Debug\Exception\FatalThrowableError : Call to undefined method Illuminate\Foundation\Application::share()

at C:\Users\vasil\pingpong-test\vendor\pingpong\menus\MenusServiceProvider.php:43
39| public function register()
40| {
41| $this->registerHtmlPackage();
42|

43| $this->app['menus'] = $this->app->share(function ($app) {
44| return new Menu($app['view'], $app['config']);
45| });
46| }
47|

Exception trace:

1 Pingpong\Menus\MenusServiceProvider::register()
C:\Users\vasil\pingpong-test\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:607

2 Illuminate\Foundation\Application::register(Object(Pingpong\Menus\MenusServiceProvider))
C:\Users\vasil\pingpong-test\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:741

Please use the argument -v to see more details.

C:\Users\vasil\pingpong-test>php artisan config:publish pingpong/menus --provider

Symfony\Component\Debug\Exception\FatalThrowableError : Call to undefined method Illuminate\Foundation\Application::share()

at C:\Users\vasil\pingpong-test\vendor\pingpong\menus\MenusServiceProvider.php:43
39| public function register()
40| {
41| $this->registerHtmlPackage();
42|

43| $this->app['menus'] = $this->app->share(function ($app) {
44| return new Menu($app['view'], $app['config']);
45| });
46| }
47|

Exception trace:

1 Pingpong\Menus\MenusServiceProvider::register()
C:\Users\vasil\pingpong-test\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:607

2 Illuminate\Foundation\Application::register(Object(Pingpong\Menus\MenusServiceProvider))
C:\Users\vasil\pingpong-test\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:741

Please use the argument -v to see more details.

P.S: composer dump-autoload or composer update not help me. Please fix for lasted versions Laravel.

Title in dividers ?

Hi,
It's is possible to have a custom title in the divider ? Or It's only blank ?
Thanks in advance!

Problem with `composer update` (after install it)?

When i install this package for the first time, it is ok.
But when i run composer update again or install other package, it show PHP Fatal error: Class 'Pingpong\Menus\MenusServiceProvider' not found....
I think that it have problem with psr-4 or not?
Please help me.

'BadMethodCallException'

php artisan vendor:publish
exception 'BadMethodCallException' with message 'Call to undefined method [package]' in /l5/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php:226
Stack trace:
#0 /l5/vendor/pingpong/menus/src/Pingpong/Menus/MenusServiceProvider.php(21): Illuminate\Support\ServiceProvider->__call('package', Array)
#1 /l5/vendor/pingpong/menus/src/Pingpong/Menus/MenusServiceProvider.php(21): Pingpong\Menus\MenusServiceProvider->package('pingpong/menus')
#2 [internal function]: Pingpong\Menus\MenusServiceProvider->boot()
#3 /l5/vendor/laravel/framework/src/Illuminate/Container/Container.php(523): call_user_func_array(Array, Array)
#4 /l5/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(624): Illuminate\Container\Container->call(Array)
#5 /l5/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(606): Illuminate\Foundation\Application->bootProvider(Object(Pingpong\Menus\MenusServiceProvider))
#6 [internal function]: Illuminate\Foundation\Application->Illuminate\Foundation{closure}(Object(Pingpong\Menus\MenusServiceProvider), 19)
#7 /l5/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(607): array_walk(Array, Object(Closure))
#8 /l5/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(15): Illuminate\Foundation\Application->boot()
#9 /l5/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(158): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(Illuminate\Foundation\Application))
#10 /l5/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(180): Illuminate\Foundation\Application->bootstrapWith(Array)
#11 /l5/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(89): Illuminate\Foundation\Console\Kernel->bootstrap()
#12 /l5/artisan(34): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 {main}

Active classes

Would it be possible to handle active classes on elements ?

Auto complete other method in callback?

You should set auto complete other method in callback like

MenuPing::create(
    'home',
    function ($menu) {
        $menu->add( // should be auto complete
            [
                'title' => 'Home',
                'url' => route('cpanel.package.home')
            ]
        );
    }
);

You can set it like Blueprint in Laravel Schema.

Laravel 5.2 problem

I got these errors when I stalled this package in L5.2 (Upgraded To 5.2.0 From 5.1)

Problem 1
    - Conclusion: remove laravel/framework v5.2.7
    - Conclusion: don't install laravel/framework v5.2.7
    - pingpong/menus v2.1.0 requires illuminate/view 5.1.* -> satisfiable by illuminate/view[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.6, v5.1.8].
    - pingpong/menus v2.1.1 requires illuminate/view 5.1.* -> satisfiable by illuminate/view[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.6, v5.1.8].
    - pingpong/menus v2.1.2 requires illuminate/view 5.1.* -> satisfiable by illuminate/view[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.6, v5.1.8].
    - pingpong/menus v2.1.5 requires illuminate/view 5.1.* -> satisfiable by illuminate/view[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.6, v5.1.8].
    - don't install illuminate/view v5.1.1|don't install laravel/framework v5.2.7
    - don't install illuminate/view v5.1.13|don't install laravel/framework v5.2.7
    - don't install illuminate/view v5.1.16|don't install laravel/framework v5.2.7
    - don't install illuminate/view v5.1.2|don't install laravel/framework v5.2.7
    - don't install illuminate/view v5.1.20|don't install laravel/framework v5.2.7
    - don't install illuminate/view v5.1.22|don't install laravel/framework v5.2.7
    - don't install illuminate/view v5.1.25|don't install laravel/framework v5.2.7
    - don't install illuminate/view v5.1.28|don't install laravel/framework v5.2.7
    - don't install illuminate/view v5.1.6|don't install laravel/framework v5.2.7
    - don't install illuminate/view v5.1.8|don't install laravel/framework v5.2.7
    - Installation request for laravel/framework == 5.2.7.0 -> satisfiable by laravel/framework[v5.2.7].
    - Installation request for pingpong/menus ^2.1 -> satisfiable by pingpong/menus[v2.1.0, v2.1.1, v2.1.2, v2.1.5].

Please fix docs.

Please fix docs at Menu Style:

// secara default mendukung 4 style : navbar, navbar-right, nav-pills dan nav-tab
to 
// secara default mendukung 4 style : navbar, navbar-right, nav-pills and nav-tab

$menu->add method

When trying to create a menu item using the $menu->add method with the following:

$menu->add([
        'route' => 'dashboard.settings',
        'title' => 'Settings',
        'icon'  => 'fa fa-cog',
        'attributes' => [
            'target' => '_blank'
        ],
        'order' => 5
    ]);

option I get an error:
Route [d] not defined.
The Menu seems to be looking for the first character of the named route instead of the entire named route. Works fine if i switch to 'url' => 'path/name' like so:

$menu->add([
        'url' => 'dashboard/settings',
        'title' => 'Settings',
        'icon'  => 'fa fa-cog',
        'attributes' => [
            'target' => '_blank'
        ],
        'order' => 5
    ]);

Is this an error with the menu system, or an error in the documentation? How can i used named routes with the add method? As far as i can tell the only way to add an icon to a menu item is via the $menu->add method.

Menu isn't visible

Good evening,

for testing purposes I use the example from "http://sky.pingpong-labs.com/docs/2.0/menus".

But when I test this, I get an site, without menu.

"First, create a file called menus.php in your app/ folder, alongside with routes.php and filters.php. The file will be automatically include if the file exists. And you can define your menus in that file."

routes.php is in folder app/http .. where is the correct place?

Please help, thanks!

Object of class Illuminate\Routing\UrlGenerator could not be converted to string

Hi,
I've got a prob when I'm using routes name.
If I do this :
$menu->url('/', 'Home'), ['icon' => 'fa fa-home']);
It's work!
But not this :
$menu->route('homepage','Home');
I've got an error :

ErrorException in MenuItem.php line 536: Object of class Illuminate\Routing\UrlGenerator could not be converted to string...

Someone have an idea where is the prob ?
Thank in advance!

Please support Laravel 5.3

i ran: composer require pingpong/menus
and i'm get error: don't install laravel/framework v5.3.22

Pingpong menu dose not support Laravel 5.3?

image as title

I need to put this
< img src="{{url('img/flags/'.$locale.'.png')}}"}> as title

$menu->dropdown('HERE' , function ($sub) { });

So $menu->dropdown('< img src="{{url('img/flags/'.$locale.'.png')}}" >' , function ($sub) { }); is not working

Any help please

Parent active state

Hi !
Do you plan to add the "active" state to the parents of the active item. For exemple if "Foo" is a submenu of "Bar" that Bar got the active class if Foo is active ?

Thanks for your work !

illuminate/support v5.1.1 requires php >=5.5.9

The latest illuminate support requested by the package puts an implicit requirement to update the php version with 5.5.9. Hence the original php requirement of > 5.3 is implicitly over ridden.

Suggest to put the illuminate support to > 5.0 to overcome the problem in composer.json.

ArrayableInterface not found

Hi,
I'm getting this error in Laravel 5.

Interface 'Illuminate\Support\Contracts\ArrayableInterface' not found 

With the following code:

Menu::create('main', function(Builder $menu)
        {
            $menu->url('products', 'Products');
        });

Artisan error

I have an error in artisan after i created in app Support/menus.php file the error is "[ErrorException]
Trying to get property of non-object". Please help me.
Thank's for all

Polymorphic / Model support

In combination with the database support, this will be needed.

It would be cool to add support for models that can implement a method to return menu details/options. This is useful in instances where you have e.g. a pages table and want to build a menu of pages based on their ID, so that if the name or slug updates, it will automatically be updated on the menu.

I'm thinking something along the lines of:

Adding the model menu item for Page ID 4

Menu::create('main', function($menu) {

    $menu->model('App\Page\Page', [
        'id' => 4
    ]);

});

Syntax

$menu->model(object|string $model, array $options)

Menus will call getMenuOptions with the page and should return details about the menu item.

class Page extends Eloquent {

    protected $table = 'pages';
    protected $fillable = [
        'name',
        'slug',
    ];

    /**
     * Get menu options.
     *
     * @param  MenuItem $item
     * @return array
     */
    public static function getMenuOptions(Page $page)
    {
        return [
            'url' => url($page->slug),
            'text' => $page->name,
        ];
    }

}

The class/method that gets called could default to the above but be customised like:

Menu::create('main', function($menu) {

    $menu->model('App\Page\Page', [
        'id' => 4,
        'handler' => 'App\MenuComposers\Page@getOptions'
    ]);

});

Issue in the Doc

Hi !
In your doc you say we can use this :
Menu::create('navbar', function($menu)
{
$menu->style('nav-pills');
$menu->add([
'route' => 'home',
'title' => 'Home',
])->add([
'url' => 'pages/about-me',
'title' => 'About Me',
]);
});

But we can't chain ->add(). Your MenuItem object doesn't have a add() method and your Builder class when calling add() return the new MenuItem object.

Ordering menu items

When using $menu->route and order, the order is appended to the url in the browser. For instance this:

$menu->route(
        'dashboard.index', // route name
        'Dashboard', 1 // title
    );

results in this menu uri: dashboard?1 That shouldn't show up.

Also, when doing a drop down the documentation says to format the order like so:

$menu->dropdown('Users', 4, function ($sub) {
        $sub->route('dashboard.users', 'Users');
        $sub->route('dashboard.roles', 'Roles');
        $sub->route('dashboard.permissions', 'Permissions');
    });

When it needs to be like this:

$menu->dropdown('Users', function ($sub) {
        $sub->route('dashboard.users', 'Users');
        $sub->route('dashboard.roles', 'Roles');
        $sub->route('dashboard.permissions', 'Permissions');
    }, 4);

Order works properly in the $menu->add method.

Please set "active" on main menu?

I create

Menu::create('navbar', function($menu)
{
    $menu->add([
            'url'   =>  '#',
            'title' =>  'Category',
        ])->child([
            'title' =>  'Sport',
            'url'   =>  'category/sport'
        ])->child([
            'title' =>  'Business',
            'url'   =>  'category/business'
        ])->child([
            'title' =>  'Travel',
            'url'   =>  'category/travel'
        ]);
});

When i click on Sport sub-menu, the Sport sub-menu is active, but Category main menu isn't active.
I think that it should be active too.

Menu not active

Example, I has routers list:

- admin.article
- admin.article.list
- admin.article.view

And my menus list:

$menu->dropdown(trans('Article'), function ($sub) {
    $sub->route('admin.article.list', trans('List'), [], 1, []);
}, 2, []);

When i vitsited to router:admin.article.view, menu Article do not add class "active".

Laravel 5

Anything special for L5? Can't test it yet.

Database menus

Would be cool to add storage mechanism for database menus.

Conflict facades

Conflict:
Please, rename aliases to

$aliases = [
            'Html' => 'Collective\Html\HtmlFacade',
            .... 
        ];

and fix html
public function getMenuWithDropDownWrapper($item)

return '<li class="dropdown">

remove pull-right inline

Pingpong menus {{ csrf_token() }} issue with laravel 5.1.6

Hi and thank you for the good work you're doing !

I'm using Pingpong-labs menus with Laravel 5.1.6 and I have an issue.

I have a login form within the menu so I used

$sub->header('

        <form class="login_form" method="POST" action="auth/login">
        <input type="hidden" name="_token" value="{{ csrf_token() }}"> ....

The problem is that {{ csrf_token() }} is not interpreted. I

1/ modified the menus.php to menus.blade.php to interpret {{ }}
2/ I changed menus.php to menus.blade.php in MenusServiceProvider.php

Any help or idea is welcome please. Thank you

Auth Role with menu

I has 2 menus, ex:

  • View Post
  • Create Post

I want show menu View Post with role user Mod, and show all menu with admin. How do it?

Thanks

Menu filter?

I want to use filter on menu. Form example I want to disable any menu by validation it with permission of user.

Not works anymore...

Hi,

I imported your package but when I try to create a menu like this:

Menu::create('navbar', function($menu)
{
$menu->url('home', 'Home', ['target' => 'blank']);
});

I have this error:
Non-static method Pingpong\Menus\Menu::create() should not be called statically, assuming $this from incompatible context

how to set dropdown-header in child menu?

Please example for me, how to set dropdown-header in child menu?

<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu2">
  <li role="presentation" class="dropdown-header">Dropdown header</li>
  ...
  <li role="presentation" class="divider"></li>
  <li role="presentation" class="dropdown-header">Dropdown header</li>
  ...
</ul>

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.