PHPackages                             wsaefulloh/nova-data-sync - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. wsaefulloh/nova-data-sync

ActiveLibrary[File &amp; Storage](/categories/file-storage)

wsaefulloh/nova-data-sync
=========================

A Laravel Nova tool for importing and exporting data from CSV or Excel files.

2.4.0(11mo ago)05MITPHPPHP ^7.3|^8.0

Since Jun 2Pushed 11mo agoCompare

[ Source](https://github.com/wsaefulloh/nova-data-sync)[ Packagist](https://packagist.org/packages/wsaefulloh/nova-data-sync)[ RSS](/packages/wsaefulloh-nova-data-sync/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (6)Versions (5)Used By (0)

Laravel Nova Data Sync
======================

[](#laravel-nova-data-sync)

This is a Laravel Nova tool to that provides features to import and export CSV files.

[![Import Action](https://raw.githubusercontent.com/wsaefulloh/nova-data-sync/main/docs/import-index.png)](https://raw.githubusercontent.com/wsaefulloh/nova-data-sync/main/docs/import-index.png)

Installation
------------

[](#installation)

You can install the package in to a Laravel app that uses Nova via composer:

```
composer require wsaefulloh/nova-data-sync
```

Publish the package's config and migrations:

```
php artisan vendor:publish --provider="Wsaefulloh\NovaDataSync\ToolServiceProvider"
```

This package requires [Laravel Horizon](https://laravel.com/docs/10.x/horizon) and comes with the package. If you have not gone through Horizon's install process yet, you can install it by running:

```
php artisan horizon:install
```

Make sure to configure Horizon's environment processes in `config/horizon.php`.

You should also migrate the job batches table:

```
php artisan queue:batches-table

php artisan migrate
```

This package also requires [spatie/laravel-media-library](https://github.com/spatie/laravel-medialibrary) and comes with this package. If you have not gone through the installation process of Media Library, you should publish the migrations for it:

```
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="medialibrary-migrations"

php artisan migrate
```

Publish Media Library's config file:

```
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="medialibrary-config"
```

Also run the following command to publish the config file for [ebess/advanced-nova-media-library](https://github.com/ebess/advanced-nova-media-library):

```
php artisan vendor:publish --tag=nova-media-library
```

Usage
-----

[](#usage)

Add the tool to your `NovaServiceProvider.php`:

```
public function tools()
{
    return [
        // ...
        new \Wsaefulloh\NovaDataSync\NovaDataSync(),
    ];
}
```

The Nova Data Sync tool should now appear in Nova's sidebar.

### Importing Data Using a Nova Action

[](#importing-data-using-a-nova-action)

To start with creating an Import feature, you will need two create two classes that extend the following:

- an `ImportProcess` class that contains the validation rules and process logic for each row of an imported CSV file.
- and an `ImportNovaAction` class that is essentially a Nova Action

Here is a sample `ImportProcessor`:

```
