/** * @param $faker * * @return array */ private function createUser($faker) { $user = ["name" => $faker->firstName . " " . $faker->lastName, "email" => $faker->unique()->email, "password" => bcrypt("123456"), "verifiedEmail" => 1]; // if this user has list a property they are may be a paid user // only 1 in 5 who list the property will paid certain kind of // over 80% of paid user choose buy credit $index = rand(1, 5); if ($index == 1) { if (rand(1, 4) == 1) { $user['type'] = 'suser'; $user['expiry_date'] = Carbon::now()->addYear(); } else { $user['type'] = 'cuser'; $user['credit'] = rand(10, 100); } } else { $user['type'] = "user"; } $newuser = User::create($user); return $newuser; }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }