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
24
24
{
25
25
$ template = File::get ($ this ->getStub ());
26
26
27
- return Str::of ($ template )
27
+ $ sql = Str::of ($ template )
28
28
->replace ('$OPTIONS ' , $ this ->options ())
29
29
->replace ('$FILES ' , $ this ->inputFiles ())
30
30
->replace ('$METHOD ' , $ this ->method ())
31
31
->replace ('$INSERTS ' , $ this ->inserts ())
32
- ->replace (' $BEGINDATA ' , $ this ->beginData ())
32
+ ->replace ("\ $BEGINDATA \n" , $ this ->beginData ())
33
33
->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 ;
34
41
}
35
42
36
43
protected function getStub (): string
@@ -68,7 +75,7 @@ protected function beginData(): string
68
75
$ sql = '' ;
69
76
if ($ this ->loader ->beginData ) {
70
77
$ sql .= 'BEGINDATA ' .PHP_EOL ;
71
- $ sql .= $ this ->arrayToCsv ($ this ->loader ->beginData ). PHP_EOL ;
78
+ $ sql .= $ this ->arrayToCsv ($ this ->loader ->beginData );
72
79
}
73
80
74
81
return $ sql ;
You can’t perform that action at this time.
0 commit comments