Loading database/factories/AuditoriaFactory.php 0 → 100644 +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, ]; } } database/seeders/AuditoriaSeeder.php 0 → 100644 +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(); } } Loading
database/factories/AuditoriaFactory.php 0 → 100644 +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, ]; } }
database/seeders/AuditoriaSeeder.php 0 → 100644 +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(); } }