Laravel 4 - 如何使用其方法生成控制器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18522918/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel 4 - How to generate a controller with its methods
提问by Hakim
I'm using Jeffrey Way
Generator
to generate my controller, but in Laravel 4
's version, I cant find a way to generate a controller with its list of methods.
我正在使用Jeffrey Way
Generator
来生成我的控制器,但是在Laravel 4
的版本中,我找不到一种方法来生成带有方法列表的控制器。
This command: php artisan generate:controller
, gives me a controller with a predefined template, but I want to declare these methods on my own.
这个命令:php artisan generate:controller
,给了我一个带有预定义模板的控制器,但我想自己声明这些方法。
回答by Lead Developer
Go to the project route directory in Command prompt
在命令提示符下转到项目路径目录
cd c:\xampp\htdocs\ProjectName
then run the command php artisan controller:make XYZController
然后运行命令 php artisan controller:make XYZController
like this
像这样
c:\xampp\htdocs\ProjectName>php artisan controller:make XYZController
now it will creates a controller with the name XYZController.php in your Controllers folder i.e
现在它将在您的 Controllers 文件夹中创建一个名为 XYZController.php 的控制器,即
c:\xampp\htdocs\ProjectName\app\controllers\XYZController.php
njoy!!.
开心!!
回答by J.T. Grimes
Looking at the source, it doesn't appear that the Generator package currently does this. You might send a feature request: https://github.com/JeffreyWay/Laravel-4-Generators/issues
查看源代码,Generator 包当前似乎没有执行此操作。您可以发送功能请求:https: //github.com/JeffreyWay/Laravel-4-Generators/issues