<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use App\SiraB;
class SirabSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        SiraB::truncate();
        $json1 = file_get_contents(database_path('seeders/data/sirab.json'));
        $data1 = json_decode($json1, true);

        // Bagi data ke dalam batch 500
        $chunks = array_chunk($data1, 500);

        foreach ($chunks as $chunk) {
            DB::table('sirab')->insert($chunk);
        }
    }
}
