mardi 3 novembre 2015

No commands registered in laravel 5?

I am trying to build a new custom command in Laravel 5 like so:

php artisan make:console Tenant --command=tenant:do

And it created the class in App\Console\Commands like so:

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class Tenant extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'tenant:do';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Run commands for all tenants.';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        echo 'Hello World!';
    }
}

But now when I try to run this command with php artisan tenant:do, it return with an error saying:

[InvalidArgumentException] There are no commands defined in the "tenant" namespace.

I am not sure what I am doing wrong?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire