I am trying to use Faker in Laravel 5. Now I need to create some users in my User table, I choose Faker.
I know how to create random firstname, lastname or userName, but I want to concatenate each FN and LN to be username, how can I do that? Here is my codes in seeder file.
public function run()
{
$faker = Faker::create();
foreach(range(1, 10) as $index) {
User::create([
'first_name' => $faker->firstName($gender = null|'male'|'female'),
'last_name' => $faker->lastName,
'username' => $faker->userName(),
'email' => $faker->email,
'password' => bcrypt($faker->password(6))
]);
}
}
Aucun commentaire:
Enregistrer un commentaire