gevorgmelkumyan / nova-csv-export
Installs: 168
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/gevorgmelkumyan/nova-csv-export
Requires
- php: >=7.3
Requires (Dev)
- laravel/framework: >=6.0
- laravel/nova: ~3.0
This package is auto-updated.
Last update: 2025-10-20 05:54:03 UTC
README
This package allows you to export resources as a csv file.
Prerequisites
- php >= 7.3
- Laravel >= 6.0
- Laravel Nova ~3.0
Installation
composer require gevorgmelkumyan/nova-csv-export
Usage
- Make the model of the resource you desire to export to use
Exportabletrait:
namespace App\Models; use GevorgMelkumyan\Models\Exportable; class User extends Authenticable { use Exportable; }
- Inside the model override
mappingarray fetched fromExportableby specifying model's attributes as keys and their labels as the values:
... protected $mapping = [ 'id' => 'ID', 'first_name' => 'First Name', 'dob' => 'Date Of Birth', ]; ...
- Inside the resource related to the model add
ExportCsvtoActionsspecifying the directory where the csv files will be stored:
use GevorgMelkumyan\Actions\ExportCsv; ... public function actions() { return [ new ExportCsv('csv'), ]; }