Open aoeng opened 2 years ago
版本是最新
class ImportEnglish extends Action { protected $selector = '.import-english'; public function handle(Request $request) { $res = Excel::import(new EnglishImport(), $request->file('file')); if ($res['code'] != 0) { return $this->response()->error($res['message']); } return $this->response()->success('上传成功')->refresh(); } public function form() { $this->file('file', '请选择文件')->required()->help('表头: [编号],年级,[一级分类],[二级分类],[三级分类],原文,翻译,类型'); } public function html() { return <<<HTML <a class="btn btn-sm btn-default import-english">导入数据</a> HTML; } }
$grid->tools(function (Grid\Tools $tools) { $tools->append(new ImportEnglish()); });
版本是最新