Skip to content

[5.x] Allow specifying a user's name non-interactively when running make:user - #12017

Closed
Jamesking56 wants to merge 2 commits into
statamic:5.xfrom
Jamesking56:fix-non-interactive-user-creation
Closed

Jamesking56 wants to merge 2 commits into
statamic:5.xfrom
Jamesking56:fix-non-interactive-user-creation

Conversation

@Jamesking56

Copy link
Copy Markdown
Contributor

Fixes #11951

This allows the user to specify a name for the new user when running make:user command non-interactively. To test, you can now run:

php please make:user --super --name "John Doe" john.doe@example.com --no-interaction

Before this PR, this would result in an error detailed in the issue. This PR fixes this by allowing the name to be specified.

@Jamesking56
Jamesking56 marked this pull request as ready for review August 3, 2025 17:44

@jasonvarga jasonvarga left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR:

  • The first_name gets saved as true, not what they entered.
  • The 3 name options should be optional.
  • The tests shouldn't need --name added to them (the errors you encountered were because you made the options required).

@Jamesking56

Copy link
Copy Markdown
Contributor Author
  • The 3 name options should be optional.

The original issue shows that the reason the current code doesn't work is because the name field is required to be set in order to create a user. If they don't set one in the command, what should the name field be set to?

@jasonvarga

jasonvarga commented Aug 4, 2025 •

Copy link
Copy Markdown
Member

I wouldn't say it's a problem with this command then. The name columns should allow nulls.

You could create a migration in your app to change the name or first_name/last_name columns to nullable.

$table->string('name')->nullable()->change();

Maybe our update_users_table migration could do this - or we could mention it in the docs.

@jasonvarga

Copy link
Copy Markdown
Member

If you'd like to make the changes, feel free, and we can reopen and merge the PR. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

make:user command not working when non-interactive

2 participants