Skip to content

Commit 76faef9

Browse files
author
jm-mwi
authored
Update readme.md
Updated docs to show the added `$should_trim` property.
1 parent d29bc4e commit 76faef9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

readme.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,21 @@ Specifying which CSV columns to import:
8282
];
8383
}
8484

85+
Trimming the whitespace from the imported data:
86+
87+
public function __construct()
88+
{
89+
$this->table = 'users';
90+
$this->csv_delimiter = '|';
91+
$this->filename = base_path().'/database/seeds/csvs/your_csv.csv';
92+
$this->mapping = [
93+
0 => 'first_name',
94+
1 => 'last_name',
95+
5 => 'age',
96+
];
97+
$this->should_trim = true;
98+
}
99+
85100
Skipping the CSV header row (Note: A mapping is required if this is done):
86101

87102
public function __construct()
@@ -95,6 +110,7 @@ Skipping the CSV header row (Note: A mapping is required if this is done):
95110
1 => 'last_name',
96111
2 => 'password',
97112
];
113+
$this->should_trim = true;
98114
}
99115

100116
### License

0 commit comments

Comments
 (0)