fzaninotto/Faker

Data produce identical on for loop

iqmal852 opened this issue · 1 comments

Summary

Picture will be self explain

Versions

Version
PHP 7.3
fzaninotto/faker 1.9.1

Self-enclosed code snippet for reproduction

$faker = Faker\Factory::create();

$entries = [];

$data = [
    "name" => $faker->name,
    "email" => $faker->unique()->safeEmail,
    "email_verified_at" => now(),
    "password" => bcrypt("password"),
    "remember_token" => $faker->name,
    "created_at" => now(),
    "updated_at" => now(),
];

for ($x = 0; $x <= 100; $x++) { 
  $entries[] = $data; 
}

$entries;

Expected output

The output should be different each time looping

Actual output

[
      [
       "name" => "Prof. Deion Huels DVM",
       "email" => "prohaska.brendan@example.com",
       "email_verified_at" => Illuminate\Support\Carbon @1590590664 {#1010},
       "password" => "$2y$10$dqhBGM5mB/CD7E9dJw.ct.cn4uozeOQtjAk./fddHQ9KBOCT1GCZq",
       "remember_token" => "Jevon Krajcik",
       "created_at" => Illuminate\Support\Carbon @1590590664 {#1007},
       "updated_at" => Illuminate\Support\Carbon @1590590664 {#1006},
     ],
     [
       "name" => "Prof. Deion Huels DVM",
       "email" => "prohaska.brendan@example.com",
       "email_verified_at" => Illuminate\Support\Carbon @1590590664 {#1010},
       "password" => "$2y$10$dqhBGM5mB/CD7E9dJw.ct.cn4uozeOQtjAk./fddHQ9KBOCT1GCZq",
       "remember_token" => "Jevon Krajcik",
       "created_at" => Illuminate\Support\Carbon @1590590664 {#1007},
       "updated_at" => Illuminate\Support\Carbon @1590590664 {#1006},
     ],
     [
       "name" => "Prof. Deion Huels DVM",
       "email" => "prohaska.brendan@example.com",
       "email_verified_at" => Illuminate\Support\Carbon @1590590664 {#1010},
       "password" => "$2y$10$dqhBGM5mB/CD7E9dJw.ct.cn4uozeOQtjAk./fddHQ9KBOCT1GCZq",
       "remember_token" => "Jevon Krajcik",
       "created_at" => Illuminate\Support\Carbon @1590590664 {#1007},
       "updated_at" => Illuminate\Support\Carbon @1590590664 {#1006},
     ],
]

Image Attachment
Screenshot 2020-05-27 at 10 46 58 PM

Solved!