argument('type'); $file_path = $this->argument('filepath'); //路径相对于项目根目录即 /public if(empty($type) || empty($file_path)){ dd('请输入完整参数'); } //用户信息导入 if($type == 'user'){ $this->makeUser($file_path); } if($type == 'patients'){ $this->makePatients($file_path); } } //导入用户 public function makeUser($file_path) { $this->importsUser($file_path); } public function importsUser($filePath) { $filePath = './public/import/' . $filePath . '.xlsx'; Excel::import(new UserInfo(), $filePath); } //导入患者 public function makePatients($file_path) { $this->importsPatients($file_path); } public function importsPatients($filePath) { $filePath = './public/import/' . $filePath . '.xlsx'; Excel::import(new PatientsInfo(), $filePath); } }