dongyou9373
dongyou9373
2019-08-01 20:01
浏览 176
已采纳

如何在控制器中执行Laravel控制台命令

I have custom console command in Laravel. How can I run it single time from controller ?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duanchi4544
    duanchi4544 2019-08-01 20:16
    已采纳

    you can call artisan command by doing something like

    Artisan::call("my:command", ['param1' => $variable, '--otherparam' => 'value']);
    
    点赞 评论