<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use \App\Models\Department;
use Illuminate\Support\Facades\File;

class DepartmentSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Department::truncate();
        $json = File::get("database/MAA_department.json");
        $countries = json_decode($json);

        foreach ($countries as $key => $value) {
            Department::insert([
                'department_id' => $value->department_id,
                'department_name' => $value->department_name,
                'manager' => $value->manager,
            ]);
        }
    }
}
