This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

anexception
anexception

I was wondering how i can generate a bunch of users from a table of username and passwords I have, to give out to front-end users ? for example I want 120 users with usernames

username password
usernumber1 kH12Bsols
usernumber2 Oslowi121s
usernumber3 ...

Last updated

mjauvin
mjauvin

Just loop through your existing credentials table records and create the User entries like this :

foreach (Db::table('credentials')->get() as $credential) {
   $user = new RainLab\User\Models\User();
   $user->username = $credential->username;
   $user->password = $credential->password;
   $user->save();
} 

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.