Created
May 18, 2021 10:23
-
-
Save nukedbit/d2fbc7e13eaa26ae556fee376bf73d91 to your computer and use it in GitHub Desktop.
UserSeeder with random users
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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