make:命令未在Laravel 5.1.7中定义

问题描述 投票:0回答:3

我正在尝试使用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
php laravel laravel-5.1
3个回答
1
投票

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

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


1
投票

我有同样的问题,但我可以解决它

php artisan make:console AssignUsers --command=users:assign

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

见:https://laravel.com/docs/5.0/commands


0
投票

尝试

php artisan make:command nameCommand

运行它:尝试php artisan nameCommand

© www.soinside.com 2019 - 2024. All rights reserved.