Compare commits

...

2 Commits

Author SHA1 Message Date
b1ek 7e1f1184fe
feat: proper faker 2024-08-30 08:10:16 +10:00
b1ek 7cee091b6d
fix: nullable db error 2024-08-30 08:10:05 +10:00
2 changed files with 7 additions and 4 deletions

View File

@ -10,7 +10,7 @@ class HistoryObserver
History::create([ History::create([
'model_id' => $model->id, 'model_id' => $model->id,
'model_name' => $model->getTable(), 'model_name' => $model->getTable(),
'before' => null, 'before' => [],
'after' => $model->toArray(), 'after' => $model->toArray(),
'action' => HistoryAction::Insert, 'action' => HistoryAction::Insert,
]); ]);
@ -33,7 +33,7 @@ class HistoryObserver
'model_id' => $model->id, 'model_id' => $model->id,
'model_name' => $model->getTable(), 'model_name' => $model->getTable(),
'before' => $model->getRawOriginal(), 'before' => $model->getRawOriginal(),
'after' => null, 'after' => [],
'action' => HistoryAction::Delete, 'action' => HistoryAction::Delete,
]); ]);
} }

View File

@ -16,8 +16,11 @@ class DatabaseSeeder extends Seeder
// User::factory(10)->create(); // User::factory(10)->create();
User::factory()->create([ User::factory()->create([
'name' => 'Test User', 'last_name' => fake()->lastName,
'email' => 'test@example.com', 'name' => fake()->name,
'middle_name' => fake()->name(),
'phone' => fake()->unique()->phoneNumber,
'email' => fake()->unique()->safeEmail,
]); ]);
} }
} }