public function run() { $faker = Faker\Factory::create(); $profile = Profile::find(1); $profile->avatar_file_name = '20151102-uhd9Byz4uP.jpg'; $profile->avatar_file_size = 2935046; $profile->save(); for ($i = 1; $i <= 9; $i++) { $profile = Profile::find($i); $profile->realname = $faker->firstName; $profile->dob = $faker->date('Y-m-d', '-18 years'); $profile->phone = $faker->phoneNumber; $profile->gender = $faker->randomElement(['male', 'female', null]); $profile->latitude = $faker->latitude; $profile->longitude = $faker->longitude; $profile->save(); } }
private function makeTheRestOfThem() { $count = User::count(); for ($i = 2; $i <= $count; $i++) { $profile = Profile::find($i); $profile->nickname = $this->faker->unique()->firstName; $profile->realname = $this->faker->lastName; $profile->dob = $this->faker->date('Y-m-d', '-18 years'); $profile->phone = $this->makeFakeKoreanPhoneNumber(); $profile->gender = $this->faker->randomElement(['male', 'female']); $profile->latitude = $this->faker->latitude; $profile->longitude = $this->faker->longitude; $profile->geo_location = $this->faker->randomElement(['서울특별시 강서구', '경기도 수원시', '부산광역시 해운대구', '경기도 안양시', '경기도 성남시', '서울특별시 강남구', '서울특별시 마포구']); $profile->bio = $this->faker->paragraph(); $profile->photo_url = url('img/avatars/' . $profile->gender . $this->faker->numberBetween(10, 24) . '.jpg'); $profile->photo_count = 1; $profile->save(); } }