Home > Enterprise >  How do you create the first admin user with privileges to create lesser users after deploying Larave
How do you create the first admin user with privileges to create lesser users after deploying Larave

Time:02-25

If my Laravel app has role-based permissions where only a type of user (superadmin) has the ability to register users, how would I create that initial user?

Should I use a seeder and create the user from there? Would the password be exposed in the code (from env variable maybe?)?

Or could I create it from the command line?

CodePudding user response:

Seeding is the way. For the password just Hash it in the same way the laravel base framework does it.

'password' => Hash::make('my secret password')

Of course, the password will be visible to those with access to your source code. Change the password when your site is up and running the first time.

  • Related