make:user command not working when non-interactive
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
- #12017 của @Jamesking56 — đã đóng, không merge
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 30/100
Hướng nghiên cứu
Start by reading src/Console/Commands/MakeUser.php around line 197 and src/Auth/Eloquent/User.php around line 76. Reproduce with users stored in the database using the two non-interactive commands in the issue, and inspect how password and name are handled. Done means the command can create the requested super user non-interactively without the reported null-user or missing-name errors.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug description
I tried to create a new User non-interactively but I'm getting an error.
php please make:user --super [email protected]
Or
php please make:user --super --password 12345678 [email protected]
I've checked the source code and found that, when the password in not present in the command ($this->password == null), the ->password(...) method is returning the current password value, which is null, instead of setting it.
https://github.com/statamic/cms/blob/5.x/src/Console/Commands/MakeUser.php#L197
https://github.com/statamic/cms/blob/5.x/src/Auth/Eloquent/User.php#L76
On the other hand, if I define the password:
php please make:user --super --password 12345678 [email protected]
It fails again because the user.name is missing. But there's no way to set it interactively.
How to reproduce
Set Users to be stored in the DB
Run:
php please make:user --super [email protected]
Or
php please make:user --super --password 12345678 [email protected]
Logs
Call to a member function makeSuper() on null
at vendor/statamic/cms/src/Console/Commands/MakeUser.php:200
196▕ ->data($this->data)
197▕ ->password($this->password);
198▕
199▕ if ($this->super || $this->option('super')) {
➜ 200▕ $user->makeSuper();
201▕ }
202▕
203▕ $user->save();
204▕
+14 vendor frames
15 please:18
Illuminate\Foundation\Application::handleCommand(Object(Symfony\Component\Console\Input\ArgvInput))
SQLSTATE[HY000]: General error: 1364 Field 'name' doesn't have a default value (Connection: mysql, SQL: insert into `users` (`email`, `password`, `super`, `id`, `updated_at`, `created_at`) values ([email protected], $2y$12$89L6ptojJvvpfD1SGCkvSOb2oEjMkoZFz2Fr.wUUTCwgJeS/tEL9K, 1, 9f5e0d1c-2d3f-428a-9c88-1b9f444768d6, 2025-07-11 19:42:36, 2025-07-11 19:42:36))
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:825
821▕ $this->getName(), $query, $this->prepareBindings($bindings), $e
822▕ );
823▕ }
824▕
➜ 825▕ throw new QueryException(
826▕ $this->getName(), $query, $this->prepareBindings($bindings), $e
827▕ );
828▕ }
829▕ }
+28 vendor frames
29 please:18
Illuminate\Foundation\Application::handleCommand(Object(Symfony\Component\Console\Input\ArgvInput))
Environment
Environment
Application Name: --------
Laravel Version: 11.45.1
PHP Version: 8.3.23
Composer Version: 2.8.9
Environment: local
Debug Mode: ENABLED
URL: ---------
Maintenance Mode: OFF
Timezone: UTC
Locale: en
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: NOT CACHED
Drivers
Broadcasting: pusher
Cache: file
Database: mysql
Logs: stack / single
Mail: log
Queue: sync
Session: database
Sentry
Enabled: MISSING DSN
Environment: local
Laravel SDK Version: 4.15.1
PHP SDK Version: 4.14.1
Release: NOT SET
Sample Rate Errors: 100%
Sample Rate Performance Monitoring: 0%
Sample Rate Profiling: NOT SET
Send Default PII: DISABLED
Spatie Permissions
Features Enabled: Default
Version: 6.20.0
Statamic
Addons: 3
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.59.0 PRO
Statamic Addons
jacksleight/statamic-bard-texstyle: 3.5.6
statamic/collaboration: 1.0.1
statamic/eloquent-driver: 4.28.0
Statamic Eloquent Driver
Asset Containers: file
Assets: eloquent
Blueprints: file
Collection Trees: eloquent
Collections: eloquent
Entries: eloquent
Forms: file
Global Sets: file
Global Variables: file
Navigation Trees: file
Navigations: file
Revisions: file
Sites: file
Taxonomies: file
Terms: file
Tokens: file
Installation
Fresh statamic/statamic site via CLI
Additional details
I'm storing the user records in the database.
- Ngôn ngữ chính
- PHP
- Star
- 4.9k
- Fork
- 647
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 100
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của statamic/cms
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
assets
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Make native filesystem directory permissions configurable to support shared POSIX ACL accessĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
accessibility
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
antlers
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
No Code Attached Yet
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
joomla/joomla-cms#48611 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Automattic/safe-publish#716 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[FrameworkBundle][SecurityBundle] Make `KernelBrowser::loginUser()` wor…Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởFrameworkBundle SecurityBundle
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
symfony/symfony-docs#23277 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
[Sync EN] hard link does not need special permissionsCó thể đã có người làm @lacatoire đã nhận hôm nay. Đang mởsync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 1 ngày