Skip to content

Commit 458fbda

Browse files
authored
Improve the readme some more
1 parent 29324a8 commit 458fbda

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ class NovaServiceProvider extends NovaApplicationServiceProvider
3737
## Options
3838
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.
3939

40-
`public static $canImportResource = false;`
41-
*Default:* `true`
40+
`public static $canImportResource = false;`
41+
*Default:* `true`
4242
Add this static property to your Resource to prevent it from showing up in the Nova CSV Import tool interface.
4343

44-
`public static function canImportResource($request): bool`
44+
`public static function canImportResource($request): bool`
4545
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.
4646

47-
`public static function excludeAttributesFromImport(): array`
48-
*Default:* `[]`
47+
`public static function excludeAttributesFromImport(): array`
48+
*Default:* `[]`
4949
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.
5050

5151

@@ -57,19 +57,24 @@ public static function canImportResource(Request $request)
5757
{
5858
return $request->user()->can("create", self::$model);
5959
}
60+
61+
public static function excludeAttributesFromImport()
62+
{
63+
return ['password'];
64+
}
6065
```
6166

6267
## Importer Class
63-
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)
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).
6469

6570
You can define your own importer class by providing the relevant class name in your published copy of this package's config file.
6671

67-
Publish the config file
72+
First, publish the config file:
6873
```
6974
php artisan vendor:publish --tag=nova-csv-import
7075
```
7176

72-
Define and register your own importer class
77+
Then, define and register your own importer class:
7378
```
7479
<?php
7580

0 commit comments

Comments
 (0)