option('all') || (! $this->option('students') && ! $this->option('schools') && ! $this->option('users')); if ($processAll || $this->option('students')) { $this->info('Fictionalizing students...'); $bar = $this->output->createProgressBar(Student::count()); Student::chunk(100, function ($students) use ($faker, $bar) { foreach ($students as $student) { $student->update([ 'first_name' => $faker->firstName(), 'last_name' => $faker->lastName(), ]); $bar->advance(); } }); $bar->finish(); $this->newLine(); } if ($processAll || $this->option('schools')) { $this->info('Fictionalizing schools...'); $bar = $this->output->createProgressBar(School::count()); School::chunk(100, function ($schools) use ($faker, $bar) { foreach ($schools as $school) { $school->update([ 'name' => $faker->city().' High School', ]); $bar->advance(); } }); $bar->finish(); $this->newLine(); } if ($processAll || $this->option('users')) { $this->info('Fictionalizing users...'); $bar = $this->output->createProgressBar(User::where('email', '!=', 'matt@mattyoung.us')->count()); User::where('email', '!=', 'matt@mattyoung.us') ->chunk(100, function ($users) use ($faker, $bar) { foreach ($users as $user) { $user->update([ 'email' => $faker->unique()->email(), 'first_name' => $faker->firstName(), 'last_name' => $faker->lastName(), 'cell_phone' => $faker->phoneNumber(), ]); $bar->advance(); } }); $bar->finish(); $this->newLine(); } $this->info('Fictionalization complete!'); } }