@@ -35,21 +35,7 @@ class Setup extends Command
35
35
public function handle ()
36
36
{
37
37
if ($ this ->confirm ("This will destroy any existing doddns configuration. Is that ok? " )) {
38
- $ this ->task ("Creating local database " , function () {
39
- if (!is_dir ($ _SERVER ['HOME ' ].'/.doddns/ ' )) {
40
- mkdir ($ _SERVER ['HOME ' ].'/.doddns/ ' , 0700 );
41
- $ this ->info ("Created .doddns directory in user's home. " );
42
- }
43
-
44
- file_put_contents (config ('database.connections.sqlite.database ' ), "" );
45
- $ this ->info ("Created or overwrited any actual databse " );
46
-
47
- Artisan::call ('migrate ' , ['--force ' => true ]);
48
-
49
- $ this ->info ("Migrated tables " );
50
-
51
- return true ;
52
- });
38
+ $ this ->createDatabase ();
53
39
}
54
40
55
41
$ this ->settings = new SettingsHelper ();
@@ -65,6 +51,25 @@ public function handle()
65
51
$ this ->info ("All done! We're good to go! " );
66
52
}
67
53
54
+ private function createDatabase ()
55
+ {
56
+ $ this ->task ("Creating local database " , function () {
57
+ if (!is_dir ($ _SERVER ['HOME ' ].'/.doddns/ ' )) {
58
+ mkdir ($ _SERVER ['HOME ' ].'/.doddns/ ' , 0700 );
59
+ $ this ->info ("Created .doddns directory in user's home. " );
60
+ }
61
+
62
+ file_put_contents (config ('database.connections.sqlite.database ' ), "" );
63
+ $ this ->info ("Created or overwrited any actual databse " );
64
+
65
+ Artisan::call ('migrate ' , ['--force ' => true ]);
66
+
67
+ $ this ->info ("Migrated tables " );
68
+
69
+ return true ;
70
+ });
71
+ }
72
+
68
73
private function updateToken ($ token )
69
74
{
70
75
if ($ this ->confirm ('Do you wish to overwrite existing saved token? ' )) {
0 commit comments