未找到Laravel 4自定义命令

时间:2015-03-25 14:12:57

标签: laravel laravel-4 command artisan

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

2 个答案:

答案 0 :(得分:1)

尝试在\ app \ start \ artisan.php中编写完整路径,如:

Artisan :: add(new App \ Commands \ PremiumSets);

答案 1 :(得分:0)

找到解决方案!确保您在routes.php中没有此代码:

工匠::呼叫(&#39;向上&#39);