[英]Illuminate\Console\Command not found when developing laravel 5.8 package
[英]Laravel 5.8 custom command not found
我使用工匠创建了一个自定义命令:
php 工匠制作:命令重置谈判
比删除缓存:
php 工匠缓存:清除
但是,如果我尝试运行: php artisan ResetNegotiations我得到了错误:
命令“ResetNegotiations”未定义。
文件ResetNegotiations.php存在于app/Console/Commands
我发现了类似的问题: - 命令未定义异常,但未修复我的。
我已在 app/Console/Kernel.ZE1BFD762321E409CEE4AC0B6E8 中将 kernel 更新为https://laravel.com/docs/5.8/artisan#registering-commands 。 缓存重建后也出现同样的错误。
kernel.php
....
protected $commands = [
Commands\ResetNegotiations::class,
//
];
我错过了什么?
这是命令:
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class resetNegotiations extends Command{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'command:name';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//
mail("######@#####.it", "Scheduledartsan ", "Command test");
}
}
protected $signature = 'command:name';
是你用来在工匠中调用命令的东西。 只需将签名更改为protected $signature = 'resetNegotiations';
如果你想使用它。 您发布的工匠命令应该在更改后工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.