@@ -66,18 +66,12 @@ public function configurePackage(Package $package): void
6666 ->startWith (function (InstallCommand $ command ) {
6767 $ command ->info ('Welcome to the Backstage setup process. ' );
6868 $ command ->comment ("Don't trip over the wires; this is where the magic happens. " );
69- $ command ->comment (' Let \ 's get started! ' );
69+ $ command ->comment (" Let's get started! " );
7070
71- // if ($command->confirm('Would you like us to install Backstage for you?', true)) {
7271 $ command ->comment ('Lights, camera, action! Setting up for the show... ' );
7372
7473 $ command ->comment ('Preparing stage... ' );
7574
76- $ command ->callSilently ('vendor:publish ' , [
77- '--tag ' => 'translations-config ' ,
78- '--force ' => true ,
79- ]);
80-
8175 $ command ->callSilently ('vendor:publish ' , [
8276 '--tag ' => 'backstage-config ' ,
8377 '--force ' => true ,
@@ -87,8 +81,6 @@ public function configurePackage(Package $package): void
8781
8882 $ this ->writeMediaPickerConfig ();
8983
90- $ this ->writeTranslationsConfig ();
91-
9284 $ command ->callSilently ('vendor:publish ' , [
9385 '--tag ' => 'backstage-migrations ' ,
9486 '--force ' => true ,
@@ -120,12 +112,27 @@ public function configurePackage(Package $package): void
120112 $ path = app ()->environmentFilePath ();
121113 file_put_contents ($ path , file_get_contents ($ path ) . PHP_EOL . $ key . '= ' . $ value );
122114
115+ if ($ command ->confirm ('Would you like to create a user? ' , true )) {
116+ $ command ->comment ('Our next performer is... ' );
117+ $ user = $ command ->ask ('Your name? ' );
118+ $ email = $ command ->ask ('Your email? ' );
119+ $ password = $ command ->secret ('Your password? ' );
120+ if ($ email && $ password ) {
121+ User::factory ()->create ([
122+ 'name ' => $ user ,
123+ 'email ' => $ email ,
124+ 'password ' => $ password ,
125+ ]);
126+ } else {
127+ $ command ->error ('Stage frights! User not created. ' );
128+ }
129+ }
130+
123131 $ command ->comment ('Raise the curtain... ' );
124- // }
125132 })
126133 ->endWith (function (InstallCommand $ command ) {
127134 $ command ->info ('The stage is cleared for a fresh start ' );
128- $ command ->comment ('You can now go on stage and start creating! ' );
135+ $ command ->comment ('You can now go on stage (/backstage) and start creating! ' );
129136 })
130137 ->askToStarRepoOnGitHub ('backstage/cms ' );
131138 });
@@ -408,90 +415,6 @@ private function writeMediaPickerConfig(?string $path = null): void
408415 file_put_contents ($ path , $ configContent );
409416 }
410417
411- private function generateTranslationsConfig (): array
412- {
413- $ config = [
414- 'scan ' => [
415- 'paths ' => [
416- app_path (),
417- resource_path ('views ' ),
418- base_path ('' ),
419- ],
420-
421- 'extensions ' => [
422- '*.php ' ,
423- '*.blade.php ' ,
424- '*.json ' ,
425- ],
426-
427- 'functions ' => [
428- 'trans ' ,
429- 'trans_choice ' ,
430- 'Lang::transChoice ' ,
431- 'Lang::trans ' ,
432- 'Lang::get ' ,
433- 'Lang::choice ' ,
434- '@lang ' ,
435- '@choice ' ,
436- '__ ' ,
437- ],
438- ],
439-
440- 'eloquent ' => [
441- 'translatable-models ' => [
442- \Backstage \Models \ContentFieldValue::class,
443- \Backstage \Models \Tag::class,
444- ],
445- ],
446-
447- 'translators ' => [
448- 'default ' => env ('TRANSLATION_DRIVER ' , 'google-translate ' ),
449-
450- 'drivers ' => [
451- 'google-translate ' => [
452- // no options
453- ],
454-
455- 'ai ' => [
456- 'provider ' => \Prism \Prism \Enums \Provider::OpenAI,
457- 'model ' => 'gpt-5 ' ,
458- 'system_prompt ' => 'You are an expert mathematician who explains concepts simply. The only thing you do it output what i ask. No comments, no extra information. Just the answer. ' ,
459- ],
460-
461- 'deep-l ' => [
462- //
463- ],
464- ],
465- ],
466- ];
467-
468- config (['translations ' => $ config ]);
469-
470- return $ config ;
471- }
472-
473- private function writeTranslationsConfig (?string $ path = null ): void
474- {
475- $ path ??= config_path ('translations.php ' );
476-
477- // Ensure directory exists
478- $ directory = dirname ($ path );
479- if (! is_dir ($ directory )) {
480- mkdir ($ directory , 0755 , true );
481- }
482-
483- // Generate the config file content
484- $ configContent = "<?php \n\n" ;
485- $ configContent .= "use Backstage\Models\Tag; \n" ;
486- $ configContent .= "use Prism\Prism\Enums\Provider; \n" ;
487- $ configContent .= "use Backstage\Models\ContentFieldValue; \n\n" ;
488-
489- // Custom export function to create more readable output
490- $ configContent .= 'return ' . $ this ->customVarExport ($ this ->generateTranslationsConfig ()) . "; \n" ;
491-
492- file_put_contents ($ path , $ configContent );
493- }
494-
495418 private function customVarExport ($ var , $ indent = '' ): string
496419 {
497420 switch (gettype ($ var )) {
0 commit comments