Laravel 4 未找到自定义命令
Laravel 4 custom commands not being found
我正在尝试使用 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);
尝试在 \app\start\artisan.php 中写下完整路径,例如:
Artisan::添加(新App\Commands\PremiumSets);
已找到解决方案!确保您的 routes.php:
中没有此代码
Artisan::调用('up');
我正在尝试使用 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);
尝试在 \app\start\artisan.php 中写下完整路径,例如:
Artisan::添加(新App\Commands\PremiumSets);
已找到解决方案!确保您的 routes.php:
中没有此代码Artisan::调用('up');