Giter Club home page Giter Club logo

nova-exports's Introduction

Laravel Nova package to export resources

Packagist Version GitHub last commit License Sonar

This package adds and universal export action to your nova application.

Requirements

  • laravel/nova: ^3.0
  • gobrightspot/nova-detached-actions: ^1.1
  • optimistdigital/nova-multiselect-field: ^2.0
  • kpolicar/nova-date-range: dev-master
  • rap2hpoutre/fast-excel: ^2.5

Usage

To use the export action, you must add it to actions method of your resource.

use Allanvb\NovaExports\ExportResourceAction;

public function actions(Request $request): array
{
    return [
        new ExportResourceAction($this),
    ];
}

Available methods

  • only(array $columns) - Define whitelist of fields that can be exported.
  • except(array $columns) - Excludes the given fields from exporting list.
  • filename(string $name) - Sets the download filename.
  • withUserSelection() - Enables multi-select field that allow user to select the columns when exporting.
  • usesDateRange(string $columnName) - Enables field that allow user to select the range of dates when exporting. Default: created_at
  • usesGenerator() - Enables cursor usage when getting data from database.
  • queryBuilder(callable $query) - Use own query on data exportation.

withUserSelection method cannot be used together with queryBuilder method.

You are also able to use all of Nova Action methods, and all of Detached Actions methods on ExportResourceAction.

Exceptions

The package can throw the following exceptions:

Exception Reason
ColumnNotFoundException Column does not exist in given table.
EmptyDataException No records to export.
RangeColumnNotDateException Given column for date range is not a date.

To do

  • Export single resource
  • Implement user selection export
  • Implement generator on exporting
  • Add way to perform joins on export
  • Add Eloquent relations export
  • Add option to export to PDF

License

The MIT License (MIT). Please see License File for more information.

nova-exports's People

Contributors

allanvb avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.