I'm trying to excute a custom Artisan command in a Controller, but it throws an CommandNotFound
Exception. In the implementation I run the command, instead of excuting the whole command 'php artisan scan {url}', I just run scan {url} because of this Answer: Running Artisan Command. I don't understand what I did wrong?
Custom Artisan Command signature
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}';
Implementation
switch ($select) {
case 'full':
\Artisan::call('scan ' . $customer->cms_url); //url == http://localhost:8888
return $request;
break;
}
Error
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)
First register your Artisan command in app/console/Kernel.php
: in commands array add your command Class. After that you can call your command like this
\Artisan::call('scan', ['url' => "{$customer->cms_url}"]);
You must wrap the url in " "
otherwise it will not set the full string
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With