How to Use Laravel Nova Excel

laravel-nova-excel

How to Use Laravel Nova Excel. This package you can use Laravel Nova Excel.

  • Easily export resources to Excel. Supercharge your Nova resources and export them directly to an Excel or CSV document. Exporting has never been so easy.
  • Supercharged resource exports. Export resources with automatic chunking for better performance. You provide us the query, we handle the performance. Exporting even larger resources? No worries, Laravel Nova Excel has your back. You can queue your exports so all of this happens in the background.
  • Export based on filters and selection. Select or filter only certain resources and export only those to Excel!
  • Export lenses. Got custom lenses defined? When exporting from a lens, it will use the query of the lens to determine which data needs to be exported!

Installation Instructions

💡 Require this package in the composer.json of your Laravel project. This will download the package and Laravel-Excel.

composer require maatwebsite/laravel-nova-excel

💪 Go to your resource. As example we’ll use the app/Nova/User.php. Add DownloadExcel action to your actions() list.

<?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,
        ];
    }
}

? Go to your resource in your Nova admin panel, select all or some users and click “Download Excel”

Laravel-Nova-Excel

? Find your users.xlsx in your downloads folder!

More installation instructions can be found at: https://laravel-excel.maatwebsite.nl/nova/1.0/getting-started/installation.html

Installation

#Requirements

  • PHP: ^7.1
  • Laravel: ^5.5
  • Laravel Nova:Orion
  • Maatwebsite Laravel Excel: ^3.0

#Installation

Before installing the package, make sure you have set-up Laravel Nova.

Require this package (maatwebsite/laravel-nova-excel) in the composer.json of your Laravel project or run the following command in your console:

composer require psr/simple-cache:^2.0 maatwebsite/laravel-nova-excel

If composer require fails on Laravel 9 because of the simple-cache dependency, you will have to specify the psr/simple-cache version as ^2.0 in your composer.json to satisfy the PhpSpreadsheet dependency. You can install both at the same time as.

#Service Provider

In case you don’t have auto-discovery enabled, you’ll have to add the following two service providers in config/app.php:

'providers' => [
    /*
     * Package Service Providers...
     */
    Maatwebsite\Excel\ExcelServiceProvider::class,
    Maatwebsite\LaravelNovaExcel\LaravelNovaExcelServiceProvider::class,
]

Download exports

Downloading an export of your resource is very easy.

In your resource class, add the Maatwebsite\LaravelNovaExcel\Actions\DownloadExcel to actions().

use Maatwebsite\LaravelNovaExcel\Actions\DownloadExcel;

public function actions(Request $request)
{
    return [
        new DownloadExcel(),
    ];
}

Now you should see “Download Excel” in your list of actions.

Download Excel

When clicking a users.xlsx document will be downloaded. The name of the file is derived from the name of the resource.

Storing exports

To store a resource export to a disk, add the Maatwebsite\LaravelNovaExcel\Actions\ExportToExcel to actions().

use Maatwebsite\LaravelNovaExcel\Actions\ExportToExcel;

public function actions(Request $request)
{
    return [
        new ExportToExcel(),
    ];
}

Now you should see “Export To Excel” in your list of actions.

Store To Excel

The users.xlxs file will be stored in your default storage folder. By default Laravel-settings this will be storage/app.

Queued

When dealing with a large resource selection (e.g. +20k models), you can choose to queue your export.

In your resource class, add the Maatwebsite\LaravelNovaExcel\Actions\QueuedExport to actions().

use Maatwebsite\LaravelNovaExcel\Actions\QueuedExport;

public function actions(Request $request)
{
    return [
        new QueuedExport(),
    ];
}

1
2
3
4
5
6
7
8

Now you should see “Export To Excel” in your list of actions.

Store To Excel

The users.xlxs file will be stored in your default storage folder. Behind the scenes the query is chunked with a chunk count of 200 and each chunk is queued.

You can customize this by using the withChunkCount() method.

/**
 * Get the actions available for the resource.
 *
 * @param  \Illuminate\Http\Request $request
 *
 * @return array
 */
public function actions(Request $request)
{
    return [
        (new QueuedExport)->withChunkCount(1000),
    ];
}

Queueing downloads is not supported! You can only queue exports that are stored to the disk.

? Learning Laravel Nova Excel

You can find the full documentation of Laravel Nova Excel on the website.

We welcome suggestions for improving our docs. The documentation repository can be found at https://github.com/Maatwebsite/laravel-excel-docs.

? License & Postcardware

Our software is open source and licensed under the MIT license.

If you use the software in your production environment we would appreciate to receive a postcard of your hometown. Please send it to:

Maatwebsite
Florijnruwe 111-2
6218 CA Maastricht
The Netherlands

More about the license can be found at: https://laravel-excel.maatwebsite.nl/3.0/getting-started/license.html

Readme

banner-nova
StyleCI
Latest Stable Version
Total Downloads
License

   

Laravel Excel logo

Supercharge your Laravel Nova resource exports

Quickstart · Documentation · Blog · Contributing · Support

✨ Features

  • Easily export resources to Excel. Supercharge your Nova resources and export them directly to an Excel or CSV document. Exporting has never been so easy.
  • Supercharged resource exports. Export resources with automatic chunking for better performance. You provide us the query, we handle the performance. Exporting even larger resources? No worries, Laravel Nova Excel has your back. You can queue your exports so all of this happens in the background.
  • Export based on filters and selection. Select or filter only certain resources and export only those to Excel!
  • Export lenses. Got custom lenses defined? When exporting from a lens, it will use the query of the lens to determine which data needs to be exported!

🚀 5 minutes quick start

💡 Require this package in the composer.json of your Laravel project. This will download the package and Laravel-Excel.

composer require maatwebsite/laravel-nova-excel

💪 Go to your resource. As example we’ll use the app/Nova/User.php. Add DownloadExcel action to your actions() list.

<?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,
        ];
    }
}

🔥 Go to your resource in your Nova admin panel, select all or some users and click “Download Excel”

Laravel-Nova-Excel

📄 Find your users.xlsx in your downloads folder!

More installation instructions can be found at: https://docs.laravel-excel.com/nova/1.1/getting-started/installation.html

🎓 Learning Laravel Excel

You can find the full documentation of Laravel Nova Excel on the website.

We welcome suggestions for improving our docs. The documentation repository can be found at https://github.com/SpartnerSoftware/laravel-excel-docs.

Some articles and tutorials can be found on our blog: https://medium.com/maatwebsite/laravel-excel/home

📬 License & Postcardware

1_5nblgs68uarg0wxxejozdq

Laravel Excel is created with love and care by Spartner (formerly known as Maatwebsite) to give back to the Laravel community. It is completely free (MIT license) to use, however the package is licensed as Postcardware. This means that if it makes it to your production environment, we would very much appreciate receiving a postcard from your hometown.

Spartner
Markt 2
6231 LS Meerssen
The Netherlands

More about the license can be found at: https://docs.laravel-excel.com/3.1/getting-started/license.html

Created by Spartner (formerly Maatwebsite)

We are a strategic development partner, creating web-based custom built software from Laravel. In need of a digital solution for your challenge? Give us a call.

https://spartner.software
info@spartner.nl
+31 (0) 10 – 7449312

Source : https://github.com/SpartnerNL/Laravel-Nova-Excel

Keywords:

  • novapackages
  • Laravel nova
  • Laravel nova excel
  • Laravel nova excel novapackages

brillian

1 Response

  1. Why i get error like this?
    In ProviderRepository.php line 208:
    Class ‘Maatwebsite\LaravelNovaExcel\LaravelNovaExcelServiceProvider’ not found

Leave a Reply

%d bloggers like this:
Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Adblockers perform their job via blocking communication with ad-forcing servers, and by hiding the webpage elements containing commercial content. By referring to filter lists containing the addresses of ad servers, ad blockers seek matches in website elements and define what should be blocked.

Adblocking detection in its turn is performed through “bait content”. Invisible to the user, such bait is implemented the way adblockers recognize it as commercial content. As soon as the webpage finishes loading, the detection algorithm calls to the properties of the bait. If the bait is hidden, the algorithm recognizes that there’s an active adblocker. Although baits are different and have different levels of complexity, it’s not that hard to disable adblock detection.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock