From a3e8785767fc98b7ad823d0721687725083cbb3f Mon Sep 17 00:00:00 2001 From: Matt Young Date: Thu, 26 Jun 2025 11:00:13 -0500 Subject: [PATCH] add ability to fictionalize data --- app/Console/Commands/fictionalize.php | 52 +++++++++++++++++++ ...dit_log_entries_message_column_to_text.php | 28 ++++++++++ 2 files changed, 80 insertions(+) create mode 100644 app/Console/Commands/fictionalize.php create mode 100644 database/migrations/2025_06_26_155129_change_audit_log_entries_message_column_to_text.php diff --git a/app/Console/Commands/fictionalize.php b/app/Console/Commands/fictionalize.php new file mode 100644 index 0000000..b860470 --- /dev/null +++ b/app/Console/Commands/fictionalize.php @@ -0,0 +1,52 @@ +first_name = $faker->firstName(); + $student->last_name = $faker->lastName(); + $student->save(); + } + + foreach (School::all() as $school) { + $school->name = $faker->city().' High School'; + $school->save(); + } + + foreach (User::where('email', '!=', 'matt@mattyoung.us')->get() as $user) { + $user->email = $faker->email(); + $user->first_name = $faker->firstName(); + $user->last_name = $faker->lastName(); + $user->cell_phone = $faker->phoneNumber(); + $user->save(); + } + } +} diff --git a/database/migrations/2025_06_26_155129_change_audit_log_entries_message_column_to_text.php b/database/migrations/2025_06_26_155129_change_audit_log_entries_message_column_to_text.php new file mode 100644 index 0000000..fde2bcd --- /dev/null +++ b/database/migrations/2025_06_26_155129_change_audit_log_entries_message_column_to_text.php @@ -0,0 +1,28 @@ +text('message')->change(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('audit_log_entries', function (Blueprint $table) { + $table->string('message')->change(); + }); + } +};