@@ -174,28 +174,28 @@ discard block |
||
174 | 174 | call_user_func($this->callback, $this); |
175 | 175 | } |
176 | 176 | |
177 | - $response = function () { |
|
177 | + $response = function() { |
|
178 | 178 | $handle = fopen('php://output', 'w'); |
179 | 179 | $titles = []; |
180 | 180 | fwrite($handle, chr(0xEF).chr(0xBB).chr(0xBF)); //导出的CSV文件是无BOM编码UTF-8,而我们通常使用UTF-8编码格式都是有BOM的。所以添加BOM于CSV中 |
181 | - $this->chunk(function ($collection) use ($handle, &$titles) { |
|
181 | + $this->chunk(function($collection) use ($handle, &$titles) { |
|
182 | 182 | Column::setOriginalGridModels($collection); |
183 | 183 | |
184 | 184 | $original = $current = $collection->toArray(); |
185 | 185 | |
186 | - $this->grid->getColumns()->map(function (Column $column) use (&$current) { |
|
186 | + $this->grid->getColumns()->map(function(Column $column) use (&$current) { |
|
187 | 187 | $current = $column->fill($current); |
188 | 188 | $this->grid->columnNames[] = $column->getName(); |
189 | 189 | }); |
190 | 190 | |
191 | 191 | // Write title |
192 | 192 | if (empty($titles)) { |
193 | - fputcsv($handle, $titles = $this->getVisiableTitles(),$this->csvSeparator); |
|
193 | + fputcsv($handle, $titles = $this->getVisiableTitles(), $this->csvSeparator); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | // Write rows |
197 | 197 | foreach ($current as $index => $record) { |
198 | - fputcsv($handle, $this->getVisiableFields($record, $original[$index]),$this->csvSeparator); |
|
198 | + fputcsv($handle, $this->getVisiableFields($record, $original[$index]), $this->csvSeparator); |
|
199 | 199 | } |
200 | 200 | }); |
201 | 201 | fclose($handle); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | protected function getVisiableTitles() |
213 | 213 | { |
214 | 214 | $titles = $this->grid->visibleColumns() |
215 | - ->mapWithKeys(function (Column $column) { |
|
215 | + ->mapWithKeys(function(Column $column) { |
|
216 | 216 | $columnName = $column->getName(); |
217 | 217 | $columnTitle = $column->getLabel(); |
218 | 218 | if (isset($this->titleCallbacks[$columnName])) { |