Laravel Voyager create user fails to prompt and aborts

288 Views Asked by At

I am trying to create a Voyager user. I enter php artisan voyager:admin [email protected] --create in a Windows command window. It aborts because the enter user prompt did not wait for my input.

What do I need to do to make it wait for an answer? I am using Laravel 8.

2

There are 2 best solutions below

0
On BEST ANSWER

This is a bug in PHP 7.4.0 on Windows so you either update to 7.4.1 or downgrade to 7.3.

0
On

I don't want to downgrade or upgrade the PHP version. So I simply solved the problem by executing these queries on the Database directly.

Password is: "password"

CREATE TABLE IF NOT EXISTS `admins` (
   `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
   `role_id` bigint(20) UNSIGNED DEFAULT NULL,
   `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
   `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
   `avatar` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT 'users/default.png',
   `password` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
   `remember_token` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
   `settings` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
   `created_at` timestamp NULL DEFAULT NULL,
   `updated_at` timestamp NULL DEFAULT NULL,
   PRIMARY KEY (`id`),
   UNIQUE KEY `admins_email_unique` (`email`),
   KEY `admins_role_id_foreign` (`role_id`)
)

INSERT INTO `admins` (`id`, `role_id`, `name`, `email`, `avatar`, `password`, 
`remember_token`, `settings`, `created_at`, `updated_at`) VALUES
(1, 1, 'Admin', '[email protected]', 'users/default.png', 
'$2y$10$QndDoDX9ccomsjWXvWu1.uRFA5iGMEBiq1A5NcdrtvxgBDW4IIsAq', NULL, NULL, 
'2023-01-09 21:40:59', '2023-01-09 21:40:59');

Admin has the role_id 1 and granted all permission by default. But If you face the permission problem, sort it out by visiting the permission_role table.