Skip to content

Instantly share code, notes, and snippets.

@nukedbit
Created May 18, 2021 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nukedbit/d2fbc7e13eaa26ae556fee376bf73d91 to your computer and use it in GitHub Desktop.
Save nukedbit/d2fbc7e13eaa26ae556fee376bf73d91 to your computer and use it in GitHub Desktop.
UserSeeder with random users
public function run()
{
if (App::environment('local')) {
if(User::where('name', '=', 'Admin')->count() === 0) {
\\App\\Models\\User::insert([
[
'name' => 'Admin',
'email' => 'admin@localhost',
'email_verified_at' => now(),
'password' => Hash::make("admin@pwd23"), // password
'remember_token' => Str::random(10)
]
]);
}
User::factory()->times(200)->create();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment