我想跑php artisan passport:client --password
从功能。
I tryed Artisan::call('passport:client');
and Artisan::command('passport:client');
但它返回undefined command
注意:我已经安装了 Laravel Passport,并且该命令在终端上运行良好
我已经找到了,在boot()
的方法PassportServiceProvider
有一个检查基本上可以防止它被调用Artisan::call
.
//PassportServiceProvider.php at line 37:
if ($this->app->runningInConsole()) {
$this->commands([
Console\InstallCommand::class,
Console\ClientCommand::class,
Console\KeysCommand::class,
]);
...
}
为了使其与一般的 artisan 命令一起工作,我们可以自己注册这些命令。某处的启动方法AuthServiceProvider
maybe.
public function boot() {
$this->commands([
Console\InstallCommand::class,
Console\ClientCommand::class,
Console\KeysCommand::class,
]);
}
现在我们可以调用Artisan::call('passport:install')
或其他 2 个命令。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)