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

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

Open
MaMouT514 opened this issue Feb 1, 2016 · 2 comments

Comments

@MaMouT514
Copy link

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!

@WaveHack
Copy link

That's because since Laravel 5.2, "The url() helper function now returns a Illuminate\Routing\UrlGenerator instance when no path is provided." (Source)

Method MenuItem->getActiveStateFromRoute calls url() without parameters, thus returning an UrlGenerator method instead of an URL string.

There's a pull request open, but pingpong-labs seems AFK to implement it.

Other people have forked the library and fixed it there. You could use Terranet's in the meantime. It's even on Packagist.

@truongthaison
Copy link

Please fix!!!!!!

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