-
Notifications
You must be signed in to change notification settings - Fork 95
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
Undefined variable app in web.php Lumen 5.5 #51
Comments
There is an option: |
Hi there, When using |
Hi @seagyn, this feature comes with verison 1.3.4: |
@wdj-ac I'm using 1.3.4? |
really? I mean, it will just use an other template to generate routes (see above). |
Yeah, really. Looked and it's not there.
I'm just manually doing it but thought it would be useful to know as it didn't solve the issue of this issue. |
I have the version 1.3.4 and steel the error: Undefined variable: app |
Hey guys, I was able to resolve this with just a temporary solution only. In my case, I was using Lumen 5.5 and the issue is triggered by the $app variable found in routes/web.php. This $app var is not recognized by Lumen because web.php uses the $router var instead. As a temporary solution, you can replace all the $app var generated by this generator to $router. Please note though, that this variable might change depending on the version and if whether you're using Laravel or Lumen. Anyways, I hope this would be helpful to anyone! NOTE: This is just a temporary solution. If time permits, I'll try to dig into the code and see if I can make a more permanent solution. Thanks! |
so i got this error too, and i figure a way to solve it in Laravel 5.5 and above. In your Application folder, Visit this path /vendor/wn/lumen-generators/templates/routes.wnt Change all app to router here Save and use the command line. It will automatically Generate the routes using $router. I should create a PR to him to solve this |
Also change back to $router in templates for webNeat#51
Routes/web.php
$app->get('task', 'TasksController@all');
$app->get('task/{id}', 'TasksController@get');
$app->post('task', 'TasksController@add');
$app->put('task/{id}', 'TasksController@put');
$app->delete('task/{id}', 'TasksController@remove');
resolved by changing $app to router.
The text was updated successfully, but these errors were encountered: