la-bas
1 week ago
128
6
Laravel

Artisan command optional array argument

Posted 1 week ago by la-bas

It is possible to define an argument of an artisan command as optional by the question mark:

protected $signature = 'build:car {brand?}';

It is also possible do define an argument as an array by using the asterisk.

protected $signature = 'build:car {brands*}';

However I can't find out how to define the argument as an optional array. Combining the asterisk and question mark doesn't seem to work.

Please sign in or create an account to participate in this conversation.