32 lines
1.1 KiB
PHP
32 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\AdminLog>
|
|
*/
|
|
class AdminLogFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'admin_id' => User::factory()->admin(),
|
|
'action' => fake()->randomElement(['create', 'update', 'delete', 'login', 'logout']),
|
|
'target_type' => fake()->randomElement(['User', 'Consultation', 'Timeline', 'Post']),
|
|
'target_id' => fake()->optional()->numberBetween(1, 100),
|
|
'old_values' => fake()->optional()->randomElements(['status' => 'pending', 'name' => 'Old Name'], null),
|
|
'new_values' => fake()->optional()->randomElements(['status' => 'approved', 'name' => 'New Name'], null),
|
|
'ip_address' => fake()->ipv4(),
|
|
'created_at' => fake()->dateTimeBetween('-30 days', 'now'),
|
|
];
|
|
}
|
|
}
|