Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot instance menu #13

Closed
ardiansyah opened this issue Nov 6, 2014 · 9 comments
Closed

Cannot instance menu #13

ardiansyah opened this issue Nov 6, 2014 · 9 comments

Comments

@ardiansyah
Copy link

hi.. thank for the package

i use this for my project but why i get error "Call to a member function url() on a non-object" or when i instance the menu from your package.

i do follows all the instruction. how to resolve it?

thanks in advance.

@noxify
Copy link
Contributor

noxify commented Nov 6, 2014

Hi,

can you give us some more information? maybe some code snippets etc.? What and where etc.

Thanks.

@ardiansyah
Copy link
Author

thanks for reply.

i just uncomment the line in menus.php in app folder after instalation the package.

$leftMenu = Menu::instance('admin-menu');

$rightMenu = Menu::instance('admin-menu-right');

/**
 * @see https://github.com/pingpong-labs/menus
 * 
 * @example adding additional menu.
 *
 * $leftMenu->url('your-url', 'The Title');
 * 
 * $leftMenu->route('your-route', 'The Title');
 */

$leftMenu->url('your-url', 'The Title');

but it give me an error "Call to a member function url() on a non-object".

Thanks.

@gravitano
Copy link
Member

Can you tell me what version are you using ?

@ardiansyah
Copy link
Author

i'am using

"pingpong/admin": "1.0.13"

and laravel 4.2

@gravitano
Copy link
Member

Try add the following code to providers array in app/config/app.php.

        'Pingpong\Menus\MenusServiceProvider',
        'Pingpong\Trusty\TrustyServiceProvider',
        'Pingpong\Admin\Providers\ConsoleServiceProvider',

And also the facade aliases at the same file.

        'Menu' => 'Pingpong\Menus\Facades\Menu',
        'Role' => 'Pingpong\Trusty\Entities\Role',
        'Permission' => 'Pingpong\Trusty\Entities\Permission',
        'Trusty' => 'Pingpong\Trusty\Facades\Trusty',

gravitano added a commit that referenced this issue Nov 6, 2014
@ardiansyah
Copy link
Author

yes i've added it before but it still gave me an error

thank for your kindness to answer

@gravitano
Copy link
Member

Try update to new version 1.0.14 and replace the following providers :

        'Pingpong\Menus\MenusServiceProvider',
        'Pingpong\Trusty\TrustyServiceProvider',
        'Pingpong\Admin\Providers\ConsoleServiceProvider',

Replace with :

    'Pingpong\Admin\Providers\SupportServiceProvider',
    'Pingpong\Admin\AdminServiceProvider',

And also now you can remove the facades aliases from your config file. Because now, that aliases will autoloaded automatically.

@ardiansyah
Copy link
Author

it still gave an error and also the defult menu doesn't appear in view like previous version..

but I resolved it by adding the menus.php in SupportServiceProvider

        require __DIR__ . '/../permissions.php';
        require __DIR__ . '/../filters.php';
        require __DIR__ . '/../composers.php';
        require __DIR__ . '/../helpers.php';
        require __DIR__ . '/../observers.php';
        require __DIR__ . '/../routes.php';
        require __DIR__ . '/../menus.php';

and it work like what I want.

thanks @gravitano

@gravitano
Copy link
Member

Hmm, thanks for telling me.

gravitano added a commit that referenced this issue Nov 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants