在Controller中调用自定义Artisan命令 Laravel

mel*_*ibi 3 command laravel artisan

我正在尝试在Controller中执行自定义Artisan命令,但它会抛出CommandNotFound异常.在实现中我运行命令,而不是排除整个命令'php artisan scan {url}',我只是运行scan {url}因为这个答案:运行Artisan命令.我不明白我做错了什么?

自定义工匠命令签名

protected $signature = 'scan {url}
                            {--r= : y or n | to follow or not to follow the robot.txt} 
                            {--fm= : set follow mode}
                            {--u= : username} 
                            {--p= : password} 
                            {--s : SQL module} 
                            {--x : XSS module}';
Run Code Online (Sandbox Code Playgroud)

履行

switch ($select) {

   case 'full':

     \Artisan::call('scan ' . $customer->cms_url); //url == http://localhost:8888
     return $request;

     break;
}
Run Code Online (Sandbox Code Playgroud)

错误

1/1) CommandNotFoundException
There are no commands defined in the "scan http" namespace.
in Application.php (line 548)
at Application->findNamespace('scan http')
in Application.php (line 582)
at Application->find('scan http://localhost:8888')
in Application.php (line 205)
Run Code Online (Sandbox Code Playgroud)

Pet*_*nev 7

首先app/console/Kernel.php在命令中注册Artisan 命令Array添加命令Class.之后你可以像这样调用你的命令

" "