定制 tu6ge/voyager-excel 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

tu6ge/voyager-excel

最新稳定版本:v2.2.0

Composer 安装命令:

composer require tu6ge/voyager-excel

包简介

voyager excel export hook

README 文档

README

Voyager Excel Export

Tests Coverage Status Latest Stable Version Packagist Downloads styleci PRs Welcome

a plugin of voyager for excel export

Required

  • voyager this is a missing laravel admin

Install

composer require tu6ge/voyager-excel

Usage

1. disable special Model

You can disable export button in special Model :

class Example extends Model
{
    public $disable_export = true;

    // ...
}

2. Allow export all records of special Model, default export selected records

class Example extends Model
{
    public $allow_export_all = true;

    // ...
}

3. Custom export excel content and format.

Now, You can customize the export excel content and format, Use more features of maatwebsite/excel:

  1. Create a custom export class , and extends Tu6ge\VoyagerExcel\Exports\AbstractExport :
<?php

namespace YourApp;

use Tu6ge\VoyagerExcel\Exports\AbstractExport;

class MyCustomExport extends AbstractExport
{
    protected $dataType;
    protected $model;

    public function __construct($dataType, array $ids)
    {
        $this->dataType = $dataType;
        $this->model = new $dataType->model_name(); // this is current Model instance
        // $ids is user selected record ids 

        // write your own idea
    }
}

Export class more usage, see laravel excel documents

  1. Associate the export with your model:
<?php

namespace Models;

use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    public $export_handler = \YourApp\MyCustomExport::class;
}

now, you export this Model data , the excel format is your custom.

Support Language

  • zh_CN
  • en

Test

run composer test command.

License

FOSSA Status

Links

Star

If this packages helped you, leave a star for the author.

Contributing

Contributing Guide

统计信息

  • 总下载量: 4.66k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 21
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 21
  • Watchers: 1
  • Forks: 11
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-08-02