本文介绍了Laravel 4生成不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是框架的新手,请帮助我.我正在尝试使用generate在控制器中创建文件.以下是命令
I am new to frameworks please help me out with this.I am trying to create a file in controller using generate. The following is the command
php artisan generate:controller features
它给我错误
[InvalidArgumentException]
生成"名称空间中没有定义命令
There are no command defined in the "generate" namespace
推荐答案
generate命令来自 JeffreyWay/Laravel-4 -Generators 软件包,要安装它,必须执行
The generate command is from the JeffreyWay/Laravel-4-Generators package, to install it you have to execute
composer require way/generators 2.*
,然后将此行添加到Service Providers数组中的app/config/app.php
中:
And then add this line to your app/config/app.php
in the Service Providers array:
'Way\Generators\GeneratorsServiceProvider'
执行后
php artisan
并检查您是否具有以下命令:
And check if you have the following commands available:
generate
generate:controller Generate a controller
generate:migration Generate a new migration
generate:model Generate a model
generate:pivot Generate a pivot table
generate:publish-templates Copy generator templates for user modification
generate:resource Generate a new resource
generate:scaffold Scaffold a new resource (with boilerplate)
generate:seed Generate a database table seeder
generate:view Generate a view
这篇关于Laravel 4生成不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!