在你的命令中添加 getArguments():
/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return array(
array('fdmprinterpath', InputArgument::REQUIRED, 'Basic slice config path'),
array('configpath', InputArgument::REQUIRED, 'User slice config path'),
array('gcodepath', InputArgument::REQUIRED, 'Path for the generated gcode'),
array('tempstlpath', InputArgument::REQUIRED, 'Path for the model that will be sliced'),
array('uid', InputArgument::REQUIRED, 'User id'),
);
}
您可以使用参数:
$fdmprinterpath = $this->argument('fdmprinterpath');
$configpath = $this->argument('configpath');
$gcodepath = $this->argument('gcodepath');
$tempstlpath = $this->argument('tempstlpath');
$uid = $this->argument('uid');
用参数调用你的命令:
Artisan::call('command:slice-model', ['fdmprinterpath' => $fdmprinterpath, 'configpath' => $configpath, 'gcodepath' => $gcodepath, 'tempstlpath' => $tempstlpath]);
有关更多信息,请参阅此article。