File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff 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+
85100Skipping 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
You can’t perform that action at this time.
0 commit comments