1

I have 2 Laravel packages; one for managing an admin panel. And the second one for filling it with useful pages.

Now the first package; let's call it AdminPackage from now on. Has a built in Menu Manager which allows me to register new headers & menu links from outside of the package.

The idea is that in my second package, which adds functionality to the first, can call the AdminPackage::menu()->addHeader() and the AdminPackage::menu()->addLink() methods to add some links to the navigation of the admin panel.

But now comes the problem:

When I call the method in my 2nd package's Service Provider I get the following error: InvalidArgumentException Route [route-name] not defined.

I have also tried putting the code directly in the Service I'm binding to the IoC container within my ServiceProvider. But same problem.

I get the error using it in both the boot() and register() method. So the routes have not been fully loaded at this point in time.

How can I solve this problem? I need to wait for the routes to finish loading and call the menu manager methods before the page is rendered and the menu items are displayed.

Thanks in advance!

Nick Verheijen
  • 229
  • 2
  • 9

0 Answers0