From 0318ec8b055ca8ee8a8f04b39c731dea76bced72 Mon Sep 17 00:00:00 2001 From: Mark Chaney Date: Mon, 26 Aug 2024 00:11:54 -0400 Subject: [PATCH] Update Import Action Docs for Sensitive method --- .../docs/07-prebuilt-actions/08-import.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/actions/docs/07-prebuilt-actions/08-import.md b/packages/actions/docs/07-prebuilt-actions/08-import.md index 3e7f90a32b..ef1dcb6159 100644 --- a/packages/actions/docs/07-prebuilt-actions/08-import.md +++ b/packages/actions/docs/07-prebuilt-actions/08-import.md @@ -159,6 +159,20 @@ ImportColumn::make('sku') Any rows that do not pass validation will not be imported. Instead, they will be compiled into a new CSV of "failed rows", which the user can download after the import has finished. The user will be shown a list of validation errors for each row that failed. +### Marking columns as sensitive +You may want to exclude certain columns from the failed import data to avoid storing sensitive or encrypted information in plain text. To achieve this, you can use the `sensitive()` method on the `ImportColumn` class: + +```php +use Filament\Actions\Imports\ImportColumn; + +ImportColumn::make('ssn') + ->label('Social Security Number') + ->sensitive() + ->rules(['required', 'digits:9']) +``` + +When a column is marked as sensitive, its data will be excluded from the JSON data stored for any failed import rows. This helps to ensure that sensitive information is not stored in a vulnerable manner. + ### Casting state Before [validation](#validating-csv-data), data from the CSV can be cast. This is useful for converting strings into the correct data type, otherwise validation may fail. For example, if you have a `price` column in your CSV, you may want to cast it to a float: @@ -850,4 +864,4 @@ public function view(User $user, Import $import): bool { return $import->user()->is($user); } -``` +``` \ No newline at end of file