在控制台中创建自己的命令后 - 使用作曲家或工匠的任何操作都会导致错误:
Method App\Console\Commands\CustomTask::isDeferred does not exist.
composer update
和 php artisan cleaner
没有帮助 - 控制台中出现同样的错误。
Composer.json-
"php": "^8.0.2",
"barryvdh/laravel-dompdf": "^2.0",
"dompdf/dompdf": "^2.0",
"guzzlehttp/guzzle": "^7.2",
"imangazaliev/didom": "^2.0",
"inertiajs/inertia-laravel": "^0.6.11",
"laravel/framework": "^9.19",
"laravel/sanctum": "^3.0",
"laravel/tinker": "^2.7",
"laravel/ui": "^4.3",
"livewire/livewire": "^2.12",
"maatwebsite/excel": "*",
"pusher/pusher-php-server": "^7.2",
"stripe/stripe-php": "^13.13"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/breeze": "^1.19",
"laravel/pint": "^1.0",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
]
你能告诉我该往哪个方向走吗?预先感谢您!
我非常感谢你!我在 Laravel 的配置文件中发现了一个错误。
创建命令时,config/app 文件中有一个条目
'providers' => [
.......
App\Console\Commands\CustomTask::class
]
卸载它解决了问题。这样,该命令就可以正常工作。任务很少,不用排队!