我是laravel新手。我试图在我的测试项目中创建一个自定义的artisan
命令来创建表格。我遵循this link,但我的命令不在工匠列表中。事件我尝试了在该链接中给出的相同示例,但它也没有工作。我不知道为什么会发生。Artisan控制台命令不工作在5.1
我这样做:
1)运行此命令php artisan make:console SendEmails
2)将完整的类代码app/Console/Commands/SendEmails.php
文件
<?php
namespace App\Console\Commands;
use App\User;
use App\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'email:send {user}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Send drip e-mails to a user';
/**
* The drip e-mail service.
*
* @var DripEmailer
*/
protected $drip;
/**
* Create a new command instance.
*
* @param DripEmailer $drip
* @return void
*/
public function __construct(DripEmailer $drip)
{
parent::__construct();
$this->drip = $drip;
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->drip->send(User::find($this->argument('user')));
}
}
请帮帮我,让我知道我在做什么错误。
您应该删除'javascript'标签,因为它与此问题无关。 –