You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A simple CSV import tool for Laravel Nova. This package builds on top of the great work done by Sparclex with the [nova-import-card](https://github.com/Sparclex/nova-import-card) package.
7
+
A simple CSV import tool for Laravel Nova that allows you to upload a CSV file via Nova and choose which Nova resource
8
+
to import it to.
9
+
10
+
The import process lets you choose how to map the relevant columns from your uploaded file to the attributes on your
11
+
models, with a nice summary at the end of what worked and what didn't
12
+
13
+
> This package builds on top of the great work done by Sparclex with the [nova-import-card](https://github.com/Sparclex/nova-import-card) package.
8
14
9
15

10
16
17
+
## Sponsorship
18
+
CSV Import is completely free to use. I've built it in my own time to fill my own needs and I also support it in my own
19
+
time. If you'd like to show your appreciation for that, I do accept [donations via GitHub](https://github.com/sponsors/simonhamp).
Once installed, you must register the component in your app's `NovaServiceProvider` (`app/Providers/NovaServiceProvider.php`):
31
+
Once installed, you must register the component in your app's `NovaServiceProvider`
32
+
(usually in `app/Providers/NovaServiceProvider.php`):
20
33
21
34
```php
22
35
namespace App\Providers;
@@ -35,18 +48,21 @@ class NovaServiceProvider extends NovaApplicationServiceProvider
35
48
```
36
49
37
50
## Options
38
-
By default, all of your Nova Resources will be available for import. However, there are a number of ways that you can explicitly limit what's available for importing.
51
+
By default, _all_ of your Nova Resources will be available for import. However, there are a number of ways that you can
52
+
explicitly limit what's available for importing.
39
53
40
54
`public static $canImportResource = false;`
41
55
*Default:*`true`
42
56
Add this static property to your Resource to prevent it from showing up in the Nova CSV Import tool interface.
43
57
44
58
`public static function canImportResource($request): bool`
45
-
Define a `canImportResource` method to use more complex logic to decide if this Resource can be shown during import. If defined, this takes precedence over the `$canImportResource` property.
59
+
Define a `canImportResource` method to use more complex logic to decide if this Resource can be shown during import.
60
+
If defined, this takes precedence over the `$canImportResource` property.
46
61
47
62
`public static function excludeAttributesFromImport(): array`
48
63
*Default:*`[]`
49
-
Define a `excludeAttributesFromImport` method that returns an array of attribute names that you want to _exclude_ from being visible in the import tool for this Resource.
64
+
Define a `excludeAttributesFromImport` method that returns an array of attribute names that you want to _exclude_ from
65
+
being visible in the import tool for this Resource.
50
66
51
67
52
68
### Example
@@ -65,9 +81,12 @@ public static function excludeAttributesFromImport()
65
81
```
66
82
67
83
## Importer Class
68
-
This package uses [maatwebsite/excel](https://github.com/Maatwebsite/Laravel-Excel) behind the scenes to handle the actual import. You can find more information about how importing [works here](https://docs.laravel-excel.com/3.1/imports/basics.html#importing-basics).
84
+
This package uses [maatwebsite/excel](https://github.com/Maatwebsite/Laravel-Excel) behind the scenes to handle the
85
+
actual import. You can find more information about how importing
0 commit comments