Used to be, you could call Artisan::call('list', ['' => 'view']); which would be analogous to calling php artisan list view but this doesn't work anymore.
Is there any other way to pass an argument?
Optional arguments would be a better solution: email:send {user?}
@aleemb try Artisan::call('list', ['<name of argument>' => 'view']);
@Quezler as mentioned in the description, it's a nameless argument analogous to artisan list view
Could you share the signature/name/arguments code from the command in question?
@Quezler it's in the bug description and again in my response above. The example command is artisan list view. For example
> artisan list view
Available commands for the "view" namespace:
view:clear Clear all compiled view files
Now try running the same command via Artisan::call(...) and getting the same output.
@aleemb give this a try:
$this->call('list', [
'namespace' => 'view'
]);
or in your case:
Artisan::call('list', [
'namespace' => 'view'
]);
the named arguments can be found on symfony/console's ListCommand.php
That works, thanks very much!
@Quezler Another hurdle is that while this works for artisan list view it doesn't work for artisan tinker /tmp/foo. The tinker cli command accepts a path as an argument. The error is that 'The "namespace" argument does not exist. I suspect this isn't a generic solution unless tinker is a special case.
These are the arguments for the TinkerCommand.php:
return [
['include', InputArgument::IS_ARRAY, 'Include file(s) before starting tinker'],
];
Thanks again, that worked.
Most helpful comment
@aleemb try
Artisan::call('list', ['<name of argument>' => 'view']);