php - Laravel 5 command - Mandatory options -


i trying write laravel command can't have options mandatory.

i understand concept of option being "optional" i'd have command in clear input inserting , in no particular order.

i.e. achieve this, par2 , par 2 mandatory

$command-abc --par1=value1 --par2=value2 

instead of:

$command-abc value1 value2 

so far signature used:

protected $signature = 'dst-comparison:analyse                         {--client : client name}                         {--clientid : client id}                         {--recordingid : client recording id}                         {--csvfile : path downloaded csv file spotify analytics}                         {--dataupdateto=null : csv data truncated date onwards}'; 

following laravel documentation (https://laravel.com/docs/5.1/artisan) , guide: http://code.tutsplus.com/tutorials/your-one-stop-guide-to-laravel-commands--net-30349 seemed overwriting getoptions method doing trick, not working me.

/**  * console command options.  *  * @return array  */ protected function getoptions() {     return array(         array('client', null, inputoption::value_required, 'client name'),         array('clientid', null, inputoption::value_required, 'client id'),         array('recordingid', null, inputoption::value_required, 'client recording id'),         array('csvfile', null, inputoption::value_required, 'path downloaded csv file spotify analytics'),         array('dataupdateto', null, inputoption::value_optional, 'csv data truncated date onwards')     ); } 

any ideas?

i think have take care of mandatory input yourself. have @ various output functions $this->error(...) , check if necessary input given $this->option('client'); (<- returns null if no input defined)

https://laravel.com/docs/master/artisan


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -