“在”命令“命名空间中没有定义命令。”运行命令后:make in Laravel
问题描述:
就像在标题中一样。我试图从工匠“在”命令“命名空间中没有定义命令。”运行命令后:make in Laravel
php artisan command:make NameOfCommand
运行,但我看到的是
There are no commands defined in the "command" namespace.
任何想法,这是什么?
答
您弄丢了命令,这一点
php artisan make:command NameOfCommand
,而不是
php artisan command:make NameOfCommand
如果您的命令中简单地写php artisan
提示它会告诉你命令的列表那边有一个look
答
In la拉威尔5.2使用PHP的工匠制作:控制台NameOfCommand
答
由于文件说,(现在的版本是5.2,在这一刻):
在Kernel.php一旦你的命令结束时,你需要工匠所以 它会进行注册可供使用。这是在 app/Console/Kernel.php文件中完成的。
文件,你必须添加: protected $commands = [ Commands\NameOfCommand::class ];
(参考:https://laravel.com/docs/5.2/artisan#registering-commands)
+1
感谢老兄此 –
谢谢你,我不应该相信的一切,我在教程看到 –