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

Artisan call make:controller wrong path #15570

Closed
maki10 opened this issue Sep 23, 2016 · 11 comments
Closed

Artisan call make:controller wrong path #15570

maki10 opened this issue Sep 23, 2016 · 11 comments

Comments

@maki10
Copy link
Contributor

maki10 commented Sep 23, 2016

  • Laravel Version: 5.3.10
  • PHP Version: 5.6.20
  • Database Driver & Version: redis

Description:

Today I try to create App namespace under controllers.
Type in console php artisan make:controller App\AppController and get success message.

After I searching the controller I see that AppController is actually in App namespace in the same place where is Models not in App\Http\Controllers\App\.

C:\git\app>php artisan make:controller App\Http\Controllers\App\AppController
Controller created successfully.

C:\git\app>php artisan make:controller App\Http\Controllers\App\App\AppController
Controller already exists!

C:\git\app>php artisan make:controller App\Http\Controllers\App\App\App\App\AppController
Controller already exists!

The controllers Are in App\Http\Controllers\AppController.php
With namespace App\Http\Controllers\App;

@nammaianh
Copy link

Use should use double back-slash instead of single. Change \ to \\

php artisan make:controller App\\AppController

@maki10
Copy link
Contributor Author

maki10 commented Sep 23, 2016

@nammaianh No, that doesn't work either...

@nammaianh
Copy link

Oh, sorry! Didn't see that you are using Windows

@nammaianh
Copy link

How about using double quote?

php artisan make:controller "App\AppController"

@maki10
Copy link
Contributor Author

maki10 commented Sep 23, 2016

@nammaianh Same, making the controller under App namespace

@nammaianh
Copy link

I think mr. Otwell wanna do this if the controller start with App namespace

@maki10
Copy link
Contributor Author

maki10 commented Sep 23, 2016

I still think this is an issue because we know where are our controllers Namespace is.

@nammaianh if Otwell wanna do this how to explain this php artisan make:controller App\Http\Controllers\App\AppController make controller in controllers namespace without folder App and giving namespace App\Http\Controllers\App

@maki10
Copy link
Contributor Author

maki10 commented Sep 23, 2016

@nammaianh you can see that wish path is \Http\Controllers in this link
So this is an issue..

@srmklive
Copy link
Contributor

srmklive commented Sep 23, 2016

@maki10 This is not an error with the framework itself. It is how you are creating your controllers. Also the code you referred in this link refers to namespace not path.

@maki10
Copy link
Contributor Author

maki10 commented Sep 23, 2016

@srmklive +1 my bad,
@themsaid For your pull request still not working php artisan make:controller App\AppController, but working with php artisan make:controller App\Http\Controllers\App\AppController

@maki10
Copy link
Contributor Author

maki10 commented Sep 23, 2016

#15575
Fixed in PR. In order to create controller under App\Http\Controllers\ in folder and namespace App, must be provide full path to controller in my case App\Http\Controllers\App\AppController

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