lupennat/import-export-card
最新稳定版本:v1.0.0
Composer 安装命令:
composer require lupennat/import-export-card
包简介
Laravel Nova - Import Export Card
README 文档
README
Requirements
php: ^7.4 | ^8laravel/nova: ^4
Installation
composer require lupennat/import-export-card
Usage
Next up, you must register the card(s). This is typically done in the card method of the corresponding resource or the NovaServiceProvider.
// in app/Nova/<Resource>.php public function cards(NovaRequest $request) { return [ new \Lupennat\ImportExportCard\ImportCard(self::class), (new \Lupennat\ImportExportCard\DownloadImportSampleCard(asset('import-samples/file.csv'))) ->withHelp('By importing you will insert a new row or update duplicate entries.'), new \Lupennat\ImportExportCard\ExportCard(self::class), ]; }
Customization
To customize the import/export process create a new importer/exporter class. The importer class is basically just an import implementation of the laravel-excel package. The exporter class is basically just an export implementation of the laravel-excel package.
The easiest way to get started is to extend Lupennat\ImportExportCard\BasicImporter or Lupennat\ImportExportCard\BasicExporter and overwrite the different methods. During the import process you may throw an exception of the type Lupennat\ImportExportCard\ImportException with an error message visible for the user. You may also add a message(): String method to customize the success message.
The custom importer/exporter classes can be registered on global or resource basis.
// app/Nova/User.php class User extends Resource { public static $importer = CustomImporter::class; public static $exporter = CustomExporter::class; // ... }
Credits
ImportExport Card is based on original Nova Import Card.
统计信息
- 总下载量: 22
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-05-23