I'm learning how to use Laravel 5 and I've ran into a problem where my controllers are being created in the root of the "app" folder instead of the "controller" folder. I have no idea why this is happening as I've re installed and checked 10 times.

I'm in gitbash on windows 8.1..

所以我走了

john@John ~/desktop/code/my-first-app
$ php artisan make:controller PagesController

然后我就

已成功创建控制器

Only it's being created in the root of app and nothing in the Controllers folder. What am I missing? I also see others having the same problem in comments under video on laracasts.

推荐答案

In Laravel 5, it is not required to specify the path. By default, it will generate the controller in the directory.

因此,可以这样创建控制器:

php artisan make:controller controllerName

However, if you would like to create it in a custom directory then refer to the line below:

php artisan make:controller pathName/controllerName

Laravel相关问答推荐

Uncaught ReferenceError:未定义require[Shopify PHP React Browser问题]

如何在Vite和Rollup中完全禁用分块?

如何计算具有特定 ID Laravel 的行

如何判断用户Electron邮件是否已存在

自定义 Laravel 关系?

判断 Laravel 中是否存在唯一索引键

验证规则 required_if 与其他条件(Laravel 5.4)

Carbon(laravel)处理无效日期

Laravel:如何通过 id 从集合中删除项目

有条件的Eager加载

Laravel - 自定义时间戳列名称

如何在 Laravel 5.2 中手动发送密码重置请求?

Laravel 说 Auth guard [] 没有定义

Laravel 5 环境配置数组?

在共享主机中仅使用 FTP 部署 Laravel 5

Laravel Eloquent ORM 复制

Laravel 4:将什么作为参数传递给 Url 类?

Eloquent的 attach/detach/sync 触发任何事件?

在 Laravel 中判断会话超时

Laravel Mix:更新 Node.js 依赖项