0

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.

mpg26262
  • 13
  • 4
  • And what can we do with this info? What is `Administrator` model/class? Are you using a package for permissions? What is the important part for being an admin, just using `Administrator`? What do you mean when you say "after I changed the database i do not know how can I regenerate admin user", how was it done the first time? Add this basic info please – matiaslauriti Apr 16 '23 at 18:04
  • your changes must reflect on the code that's why you can't use the `admin:create-user`to create a admin user – francisco Apr 17 '23 at 08:39

0 Answers0