I create a command to create accounts from a file. In the team, I passed a few arguments.
$this ->setName('batch:create') ->setDescription('xyz') ->setHelp('xyz') ->addArgument('account-id', InputArgument::REQUIRED, "Set the account id.") ->addArgument('name', InputArgument::REQUIRED, "Set the account name.");
I was just thinking if there is a way to check the type of argument passed. While I check it out,
if (is_numeric($input->getArgument('account-id'))) {
In any case, I can create a validator that checks the type, and I just need to call the validation function.
if ($input->validate() === false) { // show error message and return. }
source share