codicastudio/excel-manager

1.0.0 2020-09-25 01:53 UTC

This package is auto-updated.

Last update: 2024-09-25 14:40:59 UTC


README

banner-nova

为 Laravel Nova 资源导出加速

快速入门 · 文档 · 博客 · 贡献 · 支持

✨ 功能

  • 轻松导出资源到 Excel。 为您的 Nova 资源加速,直接导出到 Excel 或 CSV 文档。导出从未如此简单。

  • 增强资源导出。 自动分块导出资源以提高性能。您提供查询,我们处理性能。需要导出更大的资源?无需担心,Laravel Nova Excel 会支持您。您可以排队导出,所有这些都会在后台完成。

  • 基于过滤和选择导出。 仅选择或过滤某些资源,并将它们导出到 Excel!

  • 导出透镜。 定义了自定义透镜吗?当从透镜导出时,它将使用透镜的查询来确定需要导出哪些数据!

🚀 5 分钟快速入门

💡 在您的 Laravel 项目的 composer.json 中需要此包。这将下载此包和 Laravel-Excel。

composer require maatwebsite/laravel-nova-excel

💪 前往您的资源。例如,我们将使用 app/Nova/User.php。将 DownloadExcel 动作添加到您的 actions() 列表中。

<?php

namespace App\Nova;

use Illuminate\Http\Request;
use Maatwebsite\LaravelNovaExcel\Actions\DownloadExcel;

class User extends Resource
{
    /**
     * The model the resource corresponds to.
     *
     * @var string
     */
    public static $model = 'App\\User';
    
    // Other default resource methods
    
    /**
     * Get the actions available for the resource.
     *
     * @param  \Illuminate\Http\Request $request
     *
     * @return array
     */
    public function actions(Request $request)
    {
        return [
            new DownloadExcel,
        ];
    }
}