mpg26262
mpg26262

Reputation: 23

Laravel Admin - regenerate admin after database change

I am developing a Laravel application, and I use Laravel-Admin (https://laravel-admin.org/docs/en/) for an admin panel. It worked well, but after I changed the database for the application, I do not know how can I regenerate admin user for the application.

I tried seeding the database but I have not found any default seeders in DatabaseSeeder.php, after I tried putting this into my DatabaseSeeder.php file:

Encore\Admin\Auth\Database\Administrator\Administrator::create([
     'username' => 'admin',
     'password' => bcrypt('password'),
     'name'     => 'Administrator',
]);

The seeding went well, the administrator user was generated, but after logging in to the admin panel, it gave me an error: 'Permission denied'.

I have also tried the command written in the documentation: php artisan admin:create-user , but it gives me this error: Choice question must have at least 1 choice available.

Upvotes: 0

Views: 317

Answers (0)

Related Questions