Add support for generating random users
This commit is contained in:
parent
5370cfefeb
commit
31c18affb9
@ -5,6 +5,7 @@
|
||||
use App\User;
|
||||
use Faker\Generator as Faker;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@ -19,10 +20,12 @@ use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(User::class, function (Faker $faker) {
|
||||
return [
|
||||
'username' => $faker->userName,
|
||||
'name' => $faker->name,
|
||||
'email' => $faker->unique()->safeEmail,
|
||||
'email_verified_at' => now(),
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
'password' => Hash::make('Kaffekopp123'),
|
||||
'admin' => false,
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
});
|
||||
|
@ -12,6 +12,9 @@ class DatabaseSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
$this->call(UserSeeder::class);
|
||||
// Uncomment if you want to add 20 random users.
|
||||
// Alternatively run `php artisan db:seed --class=RandomUserSeeder`
|
||||
//$this->call(RandomUserSeeder::class);
|
||||
$this->call(BlogPostSeeder::class);
|
||||
}
|
||||
}
|
||||
|
16
database/seeds/RandomUserSeeder.php
Normal file
16
database/seeds/RandomUserSeeder.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class RandomUserSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
factory(App\User::class, 20)->create();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user