ibrahimtelman/voyager-excel-export

基于 voyager-excel 包的 voyager excel 导出钩子

1.0.1 2020-09-08 08:14 UTC

This package is auto-updated.

Last update: 2024-09-08 17:30:29 UTC


README

一个用于导出 Excel 的插件

安装钩子

php artisan hook:install voyager-excel-export

启用钩子

php artisan hook:enable voyager-excel-export

使用说明

将特性添加到模型中

use ExcelExport;

为模型添加设置方法

public function setExportable()
{
  //list column of table which you want to export
  //type 1 ["key1", "key2"]
  //type 2 ["key1" => "New Name", "key2" => "New Name"]
  //or with closure ["key1" => [ "name" => "New Name", "value" => function($value, $model){ return $value } ]]
  //you all free to combine three options

  //example
  return array(
    "id", "fullname" => [
          "name" => "Name",
          "value" => function ($value, $model) {
              return strtoupper($value);
          }
      ], "email" => "Email", "phone" => "Phone"
  );
}

支持语言

  • tr
  • en
  • zh_CN (中文)

许可证

MIT

链接