0
我想在Laravel 5建立一个新的自定义命令,像这样:在laravel 5中没有注册命令?
php artisan make:console Tenant --command=tenant:do
而且它在应用程序\控制台\创建的类命令,如下所示:
<?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!';
}
}
但现在当我尝试
[InvalidArgumentException]有 在“租客”没有定义的命令名称空间:与
php artisan tenant:do
运行此命令,它与一个错误说返回。
我不知道我在做什么错?
愚蠢的错误。 * facepalm *谢谢你帮助我。 :) – Rohan
np,很高兴我能协助。如果你不介意,请接受答案:) –
是的,我当时做不到。它告诉我等一会儿。 :) – Rohan