make:命令未在Laravel 5.1.7中定义

时间:2016-08-22 03:36:01

标签: php laravel laravel-5.1

我正在尝试使用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

4 个答案:

答案 0 :(得分:1)

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

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

答案 1 :(得分:1)

我有同样的问题,但我可以使用

解决它
php artisan make:console AssignUsers --command=users:assign

然后在app / Console / Kernel.php中注册命令

请参阅:https://laravel.com/docs/5.0/commands

答案 2 :(得分:0)

尝试

php artisan make:命令名命令

运行它: 尝试php artisan nameCommand

答案 3 :(得分:0)

我不知道为什么,但是我遇到了与“schedule:work”相同的问题,我通过手动将其添加到 app/console/kernel.php 中解决了

protected $commands = [
    Illuminate\Console\Scheduling\ScheduleWorkCommand::class
]

Illuminate 文件夹中有很多命令可用,但在“工匠列表”中没有显示