Reputation: 8685
This is probably a really basic question, but something I don't grasp from the docs.
I know how to create and run Artisan commands from the console, and I know how to add arguments and options like this:
artisan some:function {argument} {--option}
But is there any way to add sub-methods within this call, ie:
artisan mycommand:foo
artisan mycommand:bar
I had assumed so (otherwise what is the colon even for?) and yet I can only find information relating to options and arguments in the docs.
Is this possible, and how do I handle these within my Artisan command class? Thanks.
Upvotes: 2
Views: 1428
Reputation: 35337
This just involves two separate command classes that use the same prefix in $signature. The prefix provides a way of grouping like-commands together.
If they share functionality, use a trait or inheritance, but commands should be defined in separate classes.
Upvotes: 3