gpt4 book ai didi

php - 使 :command not defined in Laravel 5. 1.7

转载 作者:行者123 更新时间:2023-12-02 15:18:16 26 4
gpt4 key购买 nike

我正在尝试使用 make:console 创建调度程序,但它正在返回:

  [InvalidArgumentException]              
Command "make:console" is not defined.
Did you mean one of these?
make:seeder
make:migration

如果这是 5.0 之前的版本就足够了,但我目前使用的是 5.1.7。什么可能导致此问题?

这是当前可用命令的列表:

  help                Displays help for a command
list Lists commands
migrate Run the database migrations
serve Serve the application on the PHP development server
cache
cache:clear Flush the application cache
cache:table Create a migration for the cache database table
db
db:seed Seed the database with records
make
make:migration Create a new migration file
make:seeder Create a new seeder class
migrate
migrate:install Create the migration repository
migrate:refresh Reset and re-run all migrations
migrate:reset Rollback all database migrations
migrate:rollback Rollback the last database migration
migrate:status Show the status of each migration
queue
queue:failed List all of the failed queue jobs
queue:failed-table Create a migration for the failed queue jobs database table
queue:flush Flush all of the failed queue jobs
queue:forget Delete a failed queue job
queue:listen Listen to a given queue
queue:restart Restart queue worker daemons after their current job
queue:retry Retry a failed queue job
queue:subscribe Subscribe a URL to an Iron.io push queue
queue:table Create a migration for the queue jobs database table
queue:work Process the next job on a queue
schedule
schedule:run Run the scheduled commands

如果我将 composer.json 修改为 5.2.* 版本,我会收到更精简的命令选择:

  help              Displays help for a command
list Lists commands
migrate Run the database migrations
cache
cache:clear Flush the application cache
db
db:seed Seed the database with records
make
make:migration Create a new migration file
migrate
migrate:install Create the migration repository
migrate:refresh Reset and re-run all migrations
migrate:reset Rollback all database migrations
migrate:rollback Rollback the last database migration
migrate:status Show the status of each migration
queue
queue:failed List all of the failed queue jobs
queue:flush Flush all of the failed queue jobs
queue:forget Delete a failed queue job
queue:listen Listen to a given queue
queue:restart Restart queue worker daemons after their current job
queue:retry Retry a failed queue job
queue:work Process the next job on a queue
schedule
schedule:run Run the scheduled commands

最佳答案

我找到了解决方法。即使我的 Laravel CLI 缺少前面提到的命令,我仍然可以操作调度和命令文件结构。

Commands目录下手动创建example_scheduled_command.php,并在Kernal.php中注册。然后您可以将其用于 Laravel 调度。

关于php - 使 :command not defined in Laravel 5. 1.7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39071051/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com