add ability to fictionalize data

This commit is contained in:
Matt Young 2025-06-26 11:00:13 -05:00
parent 0bc80002bb
commit a3e8785767
2 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,52 @@
<?php
namespace App\Console\Commands;
use App\Models\School;
use App\Models\Student;
use App\Models\User;
use Faker\Factory;
use Illuminate\Console\Command;
class fictionalize extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'audition:fictionalize';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
public function handle()
{
$faker = Factory::create();
foreach (Student::all() as $student) {
$student->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();
}
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('audit_log_entries', function (Blueprint $table) {
$table->text('message')->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('audit_log_entries', function (Blueprint $table) {
$table->string('message')->change();
});
}
};