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)
Comments
Post a Comment