5
5
use Illuminate \Support \Arr ;
6
6
use Illuminate \Filesystem \Filesystem ;
7
7
use sixlive \DotenvEditor \DotenvEditor ;
8
+ use Illuminate \Support \Facades \Log ;
8
9
9
10
class LaravelPreset
10
11
{
@@ -16,6 +17,8 @@ class LaravelPreset
16
17
17
18
protected $ packages = [];
18
19
20
+ protected $ useHorizon = false ;
21
+
19
22
public function __construct ($ command )
20
23
{
21
24
$ this ->command = $ command ;
@@ -38,6 +41,8 @@ public function run()
38
41
39
42
// prompt for installing horizon
40
43
if ($ this ->command ->confirm ('Are you going to use Laravel Horizon? ' )) {
44
+ $ this ->useHorizon = $ this ->command ->confirm ('Use horizon instead of queue:work? ' );
45
+
41
46
array_push ($ this ->packages , 'laravel/horizon ' );
42
47
}
43
48
@@ -98,23 +103,17 @@ protected function publishStubs()
98
103
}
99
104
});
100
105
101
- if (Arr::has ($ this ->packages , 'laravel/horizon ' )) {
102
- $ useHorizon = $ this ->command ->confirm (' Use horizon instead of queue:work? ' );
103
- } else {
104
- $ useHorizon = false ;
105
- }
106
-
107
106
switch ($ this ->options ['database ' ]) {
108
107
case 'PostgreSQL ' :
109
- if ($ useHorizon ) {
108
+ if ($ this -> useHorizon ) {
110
109
copy (__DIR__ . '/stubs/postgres/docker-compose-horizon.yaml ' , base_path ('docker-compose.yaml ' ));
111
110
} else {
112
111
copy (__DIR__ . '/stubs/postgres/docker-compose.yaml ' , base_path ('docker-compose.yaml ' ));
113
112
}
114
113
copy (__DIR__ . '/stubs/postgres/Dockerfile ' , base_path ('Dockerfile ' ));
115
114
break ;
116
115
default :
117
- if ($ useHorizon ) {
116
+ if ($ this -> useHorizon ) {
118
117
copy (__DIR__ . '/stubs/mysql/docker-compose-horizon.yaml ' , base_path ('docker-compose.yaml ' ));
119
118
} else {
120
119
copy (__DIR__ . '/stubs/mysql/docker-compose.yaml ' , base_path ('docker-compose.yaml ' ));
@@ -130,7 +129,7 @@ protected function publishStubs()
130
129
copy (__DIR__ . '/stubs/phpunit.xml ' , base_path ('phpunit.xml ' ));
131
130
}
132
131
133
- protected function updateDotEnv (string $ file )
132
+ protected function updateDotEnv (string $ file, bool $ copyFile = false )
134
133
{
135
134
$ editor = new DotenvEditor ;
136
135
$ editor ->load (base_path ($ file ));
0 commit comments