定义为参数时如何在子文件夹中创建控制器? [英] How to create a controller in a sub-folder when defining as a parameter?

查看:55
本文介绍了定义为参数时如何在子文件夹中创建控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Laravel创建一个项目,并且我知道有一种方法可以使用php artisan make:model ExampleModel -m -c -r创建迁移和控制器(带有或不带有资源)以及模型.

I'm creating a project with Laravel and I'm aware that there is a way to create the migration and controller (with or without resources) along with the model with php artisan make:model ExampleModel -m -c -r.

在我的项目中,子文件夹中包含模型和控制器.分别创建模型和控制器时,可以将它们添加到子文件夹(php artisan make:model Models/example_model,并且在控制器中相同).但是我不知道如何在make:model命令上使用参数创建控制器时将其添加到子文件夹中.

In my project I have models and controllers in sub-folders. I'm able to add the model and controllers to sub-folders when creating them separately (php artisan make:model Models/example_model and same in controllers). But I don't know how to add the controllers to a sub-folder when creating them with a parameter on the make:model command.

非常感谢您能提供的任何帮助.

I really appreciate any help you can provide.

我已经尝试了以下命令,但它们似乎不起作用

I've tried the below commands already and they don't appear to be working

php artisan make:model Models/example -m -MyControllers/c -r

php artisan make:model Models/example -m MyControllers/-c -r

推荐答案

我不确定make:model命令是否可行.我最好的猜测是使用2个命令:

I'm not sure it's possible with the make:model command. My best guess is to use 2 commands:

php artisan make:model Models/NewModel -m

php artisan make:controller MyControllers/NewModelController -r

这篇关于定义为参数时如何在子文件夹中创建控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆