File tree Expand file tree Collapse file tree 5 files changed +10
-12
lines changed Expand file tree Collapse file tree 5 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -108,4 +108,4 @@ etc...
108
108
- Using Lazy Collections is the preferred method.
109
109
- Using the queue worker, you can import a several thousand rows at a time without much impact.
110
110
- Be sure to use "Database Transactions" and "Timeout Detection" to insure safe imports.
111
- - [ Article: How to Insert & Update Many at Once] ( https://medium.com/@danielalvidrez/laravel-query-builder-macros-fe176d34135e )
111
+ - [ Article: How to Insert & Update Many at Once] ( https://medium.com/@danielalvidrez/laravel-query-builder-macros-fe176d34135e )
Original file line number Diff line number Diff line change 9
9
}
10
10
],
11
11
"require" : {
12
- "php" : " ^7.2.5 " ,
12
+ "php" : " ^7.2|^8.0 " ,
13
13
"illuminate/support" : " ^6.0|^7.0|^8.0"
14
14
},
15
15
"require-dev" : {
16
- "orchestra/testbench" : " ^4.0" ,
17
- "phpunit/phpunit" : " ^8.0" ,
18
- "nunomaduro/larastan" : " ^0.4.2 "
16
+ "orchestra/testbench" : " ^4.0|^5.0|^6.0 " ,
17
+ "phpunit/phpunit" : " ^8.0|^9.0 " ,
18
+ "nunomaduro/larastan" : " ^0.6 "
19
19
},
20
20
"autoload" : {
21
21
"psr-4" : {
Original file line number Diff line number Diff line change 20
20
</whitelist >
21
21
</filter >
22
22
<logging >
23
- <log type =" tap" target =" build/report.tap" />
24
23
<log type =" junit" target =" build/report.junit.xml" />
25
- <log type =" coverage-clover" target =" clover.xml" />
24
+ <log type =" coverage-clover" target =" build/ clover.xml" />
26
25
</logging >
27
26
<php >
28
27
<env name =" APP_KEY" value =" AckfSECXIvnK5r28GVIWUAxmbBSjTsm1" />
Original file line number Diff line number Diff line change 6
6
7
7
/**
8
8
* The SimpleCsv Service Facade
9
- * @method static \Symfony\Component\HttpFoundation\StreamedResponse download(Collection|LazyCollection|\Iterator|\Generator| array $collection, string $filename)
10
- * @method static void export(Collection|LazyCollection|\Iterator|\Generator| array $collection, string $path)
9
+ * @method static \Symfony\Component\HttpFoundation\StreamedResponse download(Collection|LazyCollection|\Iterator|array $collection, string $filename)
10
+ * @method static void export(Collection|LazyCollection|\Iterator|array $collection, string $path)
11
11
* @method static LazyCollection import(string $path)
12
12
*/
13
13
class SimpleCsv extends LaravelFacade
Original file line number Diff line number Diff line change 3
3
namespace BayAreaWebPro \SimpleCsv ;
4
4
5
5
use Iterator ;
6
- use Generator ;
7
6
use SplFileObject ;
8
7
use Illuminate \Support \Collection ;
9
8
use Illuminate \Support \LazyCollection ;
10
9
use Symfony \Component \HttpFoundation \StreamedResponse ;
10
+
11
11
class SimpleCsvService
12
12
{
13
13
const DELIMITER = ', ' ;
@@ -92,7 +92,7 @@ protected function writeLine(array $line): void
92
92
93
93
protected function flattenRow ($ entry ): array
94
94
{
95
- return method_exists ($ entry , 'toArray ' ) ? $ entry ->toArray () : (array )$ entry ;
95
+ return is_object ( $ entry ) && method_exists ($ entry , 'toArray ' ) ? $ entry ->toArray () : (array )$ entry ;
96
96
}
97
97
98
98
protected function openFileObject (string $ path , string $ mode = 'r ' ): void
@@ -109,7 +109,6 @@ protected function writeLines($collection): void
109
109
{
110
110
if (
111
111
!$ collection instanceof Iterator &&
112
- !$ collection instanceof Generator &&
113
112
!$ collection instanceof Collection &&
114
113
!$ collection instanceof LazyCollection &&
115
114
!is_array ($ collection )
You can’t perform that action at this time.
0 commit comments