2016-05-27 19 views
0

Setup versuchen, ein Beispiel Konsolenbefehl auf Laravel 5.2, aber es funktioniert nichtLaravel Konsolenbefehl funktioniert nicht

Ich lief php artisan make:console CoolCommand

Hier ist meine Datei

<?php 

namespace App\Console\Commands; 

use Illuminate\Console\Command; 

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

    /** 
    * The console command description. 
    * 
    * @var string 
    */ 
    protected $description = 'Allows you to be cool'; 

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

    /** 
    * Execute the console command. 
    * 
    * @return mixed 
    */ 
    public function handle() 
    { 
     echo "Yes you are very cool!"; 
    } 
} 

Als ich php hit Handwerker das Kommando ist nicht unter der gegebenen Signatur

Was fehlt mir? Danke

+0

Haben Sie es zum Array in 'kernel.php' hinzugefügt? Siehe https://laravel.com/docs/5.2/artisan#registering-commands – iainn

Antwort

1

Wenn es nicht bei der Eingabe von php artisan aufgeführt ist, haben Sie vergessen, den Befehl wie beschrieben here zu registrieren. Öffnen Sie app/Console/Kernel.php und geben Sie Ihren Befehl ein.

protected $commands = [ 
    Commands\CoolCommand::class 
]; 
+0

autsch ... yep, ich übersehe diesen Punkt in der Dokumentation, danke – xhallix