mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
Update Import Action Docs for Sensitive method
This commit is contained in:
@@ -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);
|
||||
}
|
||||
```
|
||||
```
|
||||
Reference in New Issue
Block a user