我正在尝试使用 php artisan 在 Laravel 中创建一个自定义命令,但尽管我做了这里写的所有内容:http: //laravel.com/docs/4.2/commands包括命令的注册,它仍然没有被列出当我键入 php artisan 时,在命令列表中。
这是命令:
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class PremiumSets extends Command {
protected $name = 'sets:check';
protected $description = 'Check if any of the users did not select a premium set.';
public function __construct()
{
parent::__construct();
}
public function fire()
{
Log::error("PremiumSets Here");
}
protected function getArguments()
{
return [];
}
protected function getOptions()
{
return [];
}
}
?>
\app\start\artisan.php(我也尝试使用 Artisan::resolve() 但它仍然不起作用)
<?php
/*
|--------------------------------------------------------------------------
| Register The Artisan Commands
|--------------------------------------------------------------------------
|
| Each available Artisan command must be registered with the console so
| that it is available to be called. We'll register every command so
| the console gets access to each of the command object instances.
|
*/
Artisan::add(new PremiumSets);