File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -72,11 +72,13 @@ public function getCollection()
7272 } else {
7373 $ data = $ this ->parser ->transform ($ row , $ headers );
7474
75- if ($ this ->model ) {
76- $ data = $ this ->model ->getQuery ()->insert ($ data );
77- }
75+ if ($ data !== false ) {
76+ if ($ this ->model ) {
77+ $ data = $ this ->model ->getQuery ()->newInstance ($ data );
78+ }
7879
79- $ collection ->push ($ data );
80+ $ collection ->push ($ data );
81+ }
8082 }
8183 }
8284 }
@@ -108,12 +110,14 @@ public function save($updateIfEquals = [])
108110 $ headers = $ row ;
109111 } else {
110112 $ data = $ this ->parser ->transform ($ row , $ headers );
111- $ when = array_intersect_key ($ data , $ updateIfEquals );
112- $ values = array_diff ($ data , $ when );
113- if (!empty ($ when )) {
114- $ this ->model ->getQuery ()->updateOrInsert ($ when , $ values );
115- } else {
116- $ this ->model ->getQuery ()->insert ($ values );
113+ if ($ data !== false ) {
114+ $ when = array_intersect_key ($ data , $ updateIfEquals );
115+ $ values = array_diff ($ data , $ when );
116+ if (!empty ($ when )) {
117+ $ this ->model ->getQuery ()->updateOrInsert ($ when , $ values );
118+ } else {
119+ $ this ->model ->getQuery ()->insert ($ values );
120+ }
117121 }
118122 }
119123 }
You can’t perform that action at this time.
0 commit comments