File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -24,13 +24,20 @@ public function build(): string
2424 {
2525 $ template = File::get ($ this ->getStub ());
2626
27- return Str::of ($ template )
27+ $ sql = Str::of ($ template )
2828 ->replace ('$OPTIONS ' , $ this ->options ())
2929 ->replace ('$FILES ' , $ this ->inputFiles ())
3030 ->replace ('$METHOD ' , $ this ->method ())
3131 ->replace ('$INSERTS ' , $ this ->inserts ())
32- ->replace (' $BEGINDATA ' , $ this ->beginData ())
32+ ->replace ("\ $BEGINDATA \n" , $ this ->beginData ())
3333 ->toString ();
34+
35+ if ($ this ->loader ->beginData ) {
36+ // remove last new line from the $sql when beginData is set.
37+ $ sql = substr ($ sql , 0 , -1 );
38+ }
39+
40+ return $ sql ;
3441 }
3542
3643 protected function getStub (): string
@@ -68,7 +75,7 @@ protected function beginData(): string
6875 $ sql = '' ;
6976 if ($ this ->loader ->beginData ) {
7077 $ sql .= 'BEGINDATA ' .PHP_EOL ;
71- $ sql .= $ this ->arrayToCsv ($ this ->loader ->beginData ). PHP_EOL ;
78+ $ sql .= $ this ->arrayToCsv ($ this ->loader ->beginData );
7279 }
7380
7481 return $ sql ;
You can’t perform that action at this time.
0 commit comments