@@ -428,22 +428,26 @@ protected function runMigrations(): void
428428
429429 protected function createAdminUser (string $ kebabName , string $ serviceKey = '' , string $ serviceName = '' ): array
430430 {
431- $ adminEmail = when (empty ($ serviceKey ), "admin@ {$ kebabName }.com " , "admin. {$ serviceKey }@ {$ kebabName }.com " );
431+ $ isServiceAdmin = (!empty ($ serviceKey ) && !empty ($ serviceName ));
432+
433+ $ adminEmail = when ($ isServiceAdmin , "admin. {$ serviceKey }@ {$ kebabName }.com " , "admin@ {$ kebabName }.com " );
432434 $ defaultPassword = substr (md5 (uniqid ()), 0 , 8 );
433435
434- $ serviceLabel = when (! empty ( $ serviceName ) , " for {$ serviceName }" );
436+ $ serviceLabel = when ($ isServiceAdmin , " for {$ serviceName }" );
435437
436438 $ adminCredentials = [
437439 'email ' => $ this ->ask ("Please enter admin email {$ serviceLabel }" , $ adminEmail ),
438440 'password ' => $ this ->ask ("Please enter admin password {$ serviceLabel }" , $ defaultPassword ),
439441 ];
440442
443+ $ adminName = when ($ isServiceAdmin , "{$ serviceName } Admin " , 'Admin ' );
444+
441445 if ($ this ->authType === AuthTypeEnum::None) {
442- $ adminCredentials ['name ' ] = $ this ->ask ("Please enter admin name {$ serviceLabel }" , "{ $ serviceName } Admin " );
446+ $ adminCredentials ['name ' ] = $ this ->ask ("Please enter admin name {$ serviceLabel }" , $ adminName );
443447 $ adminCredentials ['role_id ' ] = $ this ->ask ("Please enter admin role id {$ serviceLabel }" , RoleEnum::Admin->value );
444448 }
445449
446- if (empty ( $ serviceName ) ) {
450+ if (! $ isServiceAdmin ) {
447451 $ this ->adminCredentials = $ adminCredentials ;
448452 }
449453
0 commit comments