laravel学习之路4artisan

php artisan list
php artisan help migrate
Tinker 让你可以在命令行中与 Laravel 应用进行交互php artisan tinker
在routes/console.php里面可以加闭包命令
Artisan::command('build {project}', function ($project) {
$this->info("Building {$project}!");
})->describe('Build the project, yeah');
php artisan build elesos
参数及选项都包在大括号中
不接收值的选项,当在命令中写出时,值为true,不写表示false
注册app/Console/Kernel.php
protected $commands = [ CommandsSendEmails::class ];
Route::get('/foo', function () { $exitCode = Artisan::call('email:send', [ 'user' => 1, '--queue' => 'default' ]); // });
还可以命令中调用其它命令
原文地址:https://www.cnblogs.com/elesos/p/7383751.html