Php 未找到Laravel 5.8自定义命令
我已使用artisan创建了自定义命令: php artisan make:命令重置协商 比已删除的缓存具有: php artisan缓存:清除 但是如果我尝试运行:php artisan,我会得到错误: 未定义命令“重置协商” 文件ResetNegotiations.php存在于app/Console/Commands中 我发现了类似的问题: -但它并没有解决我的问题 我已经在app/Console/kernel.php中更新了内核,但是。。。没有什么。同样的错误也发生在缓存重建之后 kernel.phpPhp 未找到Laravel 5.8自定义命令,php,laravel,laravel-5.8,laravel-artisan,Php,Laravel,Laravel 5.8,Laravel Artisan,我已使用artisan创建了自定义命令: php artisan make:命令重置协商 比已删除的缓存具有: php artisan缓存:清除 但是如果我尝试运行:php artisan,我会得到错误: 未定义命令“重置协商” 文件ResetNegotiations.php存在于app/Console/Commands中 我发现了类似的问题: -但它并没有解决我的问题 我已经在app/Console/kernel.php中更新了内核,但是。。。没有什么。同样的错误也发生在缓存重建之后 kern
....
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");
}
受保护的$signature='command:name'
是您在artisan中调用命令的方法。只需将签名更改为protected$signature='resetNegotiations'代码>如果你想使用它。您发布的artisan命令应在更改后生效 protected$signature='command:name'
是您在artisan中调用命令的方法。只需将签名更改为protected$signature='resetNegotiations'代码>如果你想使用它。您发布的artisan命令应在更改后生效 您应该使用camelcasting,否则文件将无法正确自动加载。因此,将类重命名为ResetNegotiations
,将文件重命名为ResetNegotiations.php
谢谢。我已经用大写字母更新了类名、类文件和内核。刷新了缓存,但命令artisan列表显示除我的命令以外的所有命令。您应该使用camelcasting,否则文件将无法正确自动加载。因此,将类重命名为ResetNegotiations
,将文件重命名为ResetNegotiations.php
谢谢。我已经用大写字母更新了类名、类文件和内核。刷新缓存,但命令artisan列表显示除我以外的所有命令。