Commit f3c78202 authored by Alfonso Rafael Solis Rangel's avatar Alfonso Rafael Solis Rangel
Browse files

Seeder para probar la auditoria con 70 mil registros

parent fd263648
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
<?php

namespace Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;
use App\Models\Auditoria;
use App\Models\Contacto;
use App\Models\User;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Auditoria>
 */
class AuditoriaFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    protected $model = Auditoria::class;
    
    public function definition(): array
    {
        return [
            'campo_editado' => $this->faker->word(),
            'valor_anterior' => $this->faker->sentence(),
            'nuevo_valor' => $this->faker->sentence(),
            'contacto_id' => Contacto::inRandomOrder()->first()->id ?? null,
            'user_id' => User::inRandomOrder()->first()->id ?? null, 
        ];
    }
}
+18 −0
Original line number Diff line number Diff line
<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\Auditoria;

class AuditoriaSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        Auditoria::factory()->count(10000)->create();
    }
}