<?php

namespace Database\Seeders;

use App\Models\Nationality;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trunc;

class NationalitySeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        Nationality::truncate();
        $nationality = file_get_contents(resource_path('json/countries.json'));
        $nationality = json_decode($nationality, true);
        foreach ($nationality as $item) {
            Nationality::create([
                'name' => $item['english_name'],
                'name_ar' => $item['arabic_name'],
                'country_code' => $item['alpha2_code'],
                'status' => 1,
            ]);
        }
    }
}
