关于php:Laravel 5.8自定义命令未找到

Laravel 5.8 custom command not found

我使用工匠创建了一个自定义命令:

php artisan make:command resetNegotiations

与以下已删除的缓存相比:

php artisan cache:clear

但是,如果我尝试运行:php artisan ResetNegotiations,则会收到错误消息:

Command"ResetNegotiations" is not defined.

ResetNegotiations.php文件存在于app / Console / Commands

我发现了类似的问题:
-命令未定义异常,但未解决。

我已经将内核更新为app / Console / Kernel.php中的https://laravel.com/docs/5.8/artisan#registering-commands,但是……什么也没有。重建缓存后,也会出现相同的错误。

kernel.php

1
2
3
4
5
6
 ....
 protected $commands = [
    Commands\
esetNegotiations::class,
    //
];

我缺少什么?

这是命令:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?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';。您发布的工匠命令应在更改后起作用。