php “'command' 命名空间中没有定义任何命令。” 运行命令后:在 Laravel 中制作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32396158/
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
"There are no commands defined in the 'command' namespace." after running command:make in Laravel
提问by Zbigniew Kis?y
Just like in title. I'm trying to run from artisan
就像标题一样。我试图逃避工匠
php artisan command:make NameOfCommand
but all I see is
但我所看到的是
There are no commands defined in the "command" namespace.
Any idea what is this?
知道这是什么吗?
回答by Alejandro Silva
As the documentation says (Current version is 5.2 at this moment):
正如文档所说(当前版本为 5.2):
Once your command is finished, you need to register it with Artisan so it will be available for use. This is done within the app/Console/Kernel.php file.
命令完成后,您需要在 Artisan 中注册它,以便它可以使用。这是在 app/Console/Kernel.php 文件中完成的。
in the Kernel.php file you must add:
protected $commands = [
Commands\NameOfCommand::class
];
在 Kernel.php 文件中,您必须添加:
protected $commands = [
Commands\NameOfCommand::class
];
(ref: https://laravel.com/docs/5.2/artisan#registering-commands)
(参考:https: //laravel.com/docs/5.2/artisan#registering-commands)
回答by Narendrasingh Sisodia
回答by Taytus
In laravel 5.2 use php artisan make:console NameOfCommand
在 Laravel 5.2 中使用 php artisan make:console NameOfCommand