@@ -80,27 +80,19 @@ public function handle(): void
8080 field: 'email of code owner / team lead ' ,
8181 rules: 'required|email ' ,
8282 );
83-
83+
8484 $ this ->appUrl = $ this ->ask ('Please enter an application URL ' , "https://api.dev. {$ kebabName }.com " );
8585
8686 $ envFile = (file_exists ('.env ' )) ? '.env ' : '.env.example ' ;
8787
88- $ this ->createOrUpdateConfigFile (
89- separator: '= ' ,
90- data: [
91- 'APP_NAME ' => $ this ->appName ,
92- ],
93- env: $ envFile
94- );
88+ $ this ->createOrUpdateConfigFile ($ envFile , '= ' , [
89+ 'APP_NAME ' => $ this ->appName ,
90+ ]);
9591
96- $ this ->createOrUpdateConfigFile (
97- separator: '= ' ,
98- data: [
99- 'APP_NAME ' => $ this ->appName ,
100- 'APP_URL ' => $ this ->appUrl ,
101- ],
102- envDevelopment: '.env.development '
103- );
92+ $ this ->createOrUpdateConfigFile ('.env.development ' , '= ' , [
93+ 'APP_NAME ' => $ this ->appName ,
94+ 'APP_URL ' => $ this ->appUrl ,
95+ ]);
10496
10597 $ this ->info ('Project initialized successfully! ' );
10698
@@ -113,14 +105,9 @@ public function handle(): void
113105 if ($ this ->authType === AuthTypeEnum::Clerk) {
114106 $ this ->enableClerk ();
115107
116- $ this ->createOrUpdateConfigFile (
117- separator: '= ' ,
118- data: [
119- 'AUTH_GUARD ' => 'clerk ' ,
120- ],
121- envDevelopment: '.env.development ' ,
122- env: $ envFile
123- );
108+ $ this ->createOrUpdateConfigFile ($ envFile , '= ' , [
109+ 'AUTH_GUARD ' => 'clerk ' ,
110+ ]);
124111 }
125112
126113 if ($ this ->confirm ('Do you want to generate an admin user? ' , true )) {
@@ -207,7 +194,7 @@ public function handle(): void
207194 protected function setAutoDocContactEmail (string $ email ): void
208195 {
209196 $ config = ArrayFile::open (base_path ('config/auto-doc.php ' ));
210-
197+
211198 $ config ->set ('info.contact.email ' , $ email );
212199
213200 $ config ->write ();
@@ -309,9 +296,9 @@ protected function fillContacts(): void
309296
310297 $ this ->removeTag ($ filePart , $ key );
311298 }
312-
299+
313300 $ this ->setReadmeValue ($ filePart , 'team_lead_link ' , $ this ->codeOwnerEmail );
314-
301+
315302 $ this ->updateReadmeFile ($ filePart );
316303 }
317304
@@ -401,31 +388,29 @@ protected function publishMigration(View $view, string $migrationName): void
401388 file_put_contents ("database/migrations/ {$ migrationName }" , "<?php \n\n{$ data }" );
402389 }
403390
404- protected function createOrUpdateConfigFile (string $ separator , array $ data , ... $ fileNames ): void
391+ protected function createOrUpdateConfigFile (string $ fileName , string $ separator , array $ data ): void
405392 {
406- foreach ($ fileNames as $ fileName ) {
407- $ parsed = file_get_contents ($ fileName );
393+ $ parsed = file_get_contents ($ fileName );
408394
409- $ lines = explode ("\n" , $ parsed );
395+ $ lines = explode ("\n" , $ parsed );
410396
411- foreach ($ data as $ key => $ value ) {
412- $ value = $ this ->addQuotes ($ value );
397+ foreach ($ data as $ key => $ value ) {
398+ $ value = $ this ->addQuotes ($ value );
413399
414- foreach ($ lines as &$ line ) {
415- if (Str::contains ($ line , $ key )) {
416- $ line = "{$ key }{$ separator }{$ value }" ;
400+ foreach ($ lines as &$ line ) {
401+ if (Str::contains ($ line , $ key )) {
402+ $ line = "{$ key }{$ separator }{$ value }" ;
417403
418- continue 2 ;
419- }
404+ continue 2 ;
420405 }
421-
422- $ lines [] = "\n{$ key }{$ separator }{$ value }" ;
423406 }
424407
425- $ ymlSettings = implode ("\n" , $ lines );
426-
427- file_put_contents ($ fileName , $ ymlSettings );
408+ $ lines [] = "\n{$ key }{$ separator }{$ value }" ;
428409 }
410+
411+ $ ymlSettings = implode ("\n" , $ lines );
412+
413+ file_put_contents ($ fileName , $ ymlSettings );
429414 }
430415
431416 protected function loadReadmePart (string $ fileName ): string
0 commit comments