notalentgeek's avatar

Creating a Lumen Package: How can I bing `$router` from the module?

I am following strictly this tutorial: http://blog.cloudoki.com/creating-a-lumen-package/

I am using the most recent Lumen 5.6. Where $app->get(...) is changed into $router->get(...). During the tutorial I encountered that include __DIR__.'/../Routes/web.php'; inside module Service Provider register() returns an error:

 (1/1) ErrorException

Undefined variable: router

I think, I need to bind somewhere the $router vairable from the main application into the module. Is it? How can the tutorial works with the most recent Lumen?

0 likes
1 reply
notalentgeek's avatar
notalentgeek
OP
Best Answer
Level 1

Nevermind, I solved it~

It is supossed to be $this->app->router->get() instead of $router->get().

2 likes

Please or to participate in this conversation.