Home

Awesome

<!-- vscode-markdown-toc --> <!-- vscode-markdown-toc-config numbering=true autoSave=true /vscode-markdown-toc-config --> <!-- /vscode-markdown-toc -->

Voyager Excel Export

Tests Coverage Status Latest Stable Version Packagist Downloads styleci PRs Welcome

a plugin of voyager for excel export

<a name='Required'></a>Required

<a name='Install'></a>Install

composer require tu6ge/voyager-excel

<a name='Usage'></a>Usage

1. <a name='disablespecialModel'></a>disable special Model

You can disable export button in special Model :

class Example extends Model
{
    public $disable_export = true;

    // ...
}

2. <a name='export-all'></a>Allow export all records of special Model, default export selected records

class Example extends Model
{
    public $allow_export_all = true;

    // ...
}

3. <a name='custom-export'></a>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.

<a name='SupportLanguage'></a>Support Language

<a name='Test'></a>Test

run composer test command.

<a name='License'></a>License

FOSSA Status

<a name='Links'></a>Links

<a name='Star'></a>Star

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

<a name='Contributing'></a>Contributing

Contributing Guide