承接 lupennat/import-export-card 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lupennat/import-export-card

最新稳定版本:v1.0.0

Composer 安装命令:

composer require lupennat/import-export-card

包简介

Laravel Nova - Import Export Card

README 文档

README

  1. Requirements
  2. Installation
  3. Usage
  4. Customization

Requirements

  • php: ^7.4 | ^8
  • laravel/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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-23