<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\MaaUser;
use File;
class MaaUserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        //
        MaaUser::truncate();

        $json = File::get("database/MAA.json");
        $countries = json_decode($json);

        foreach ($countries as $key => $value) {
            MaaUser::create([
                'job_id' => $value->UserID,
                'name' => $value->UserName,
                'department' => $value->DepartmentName,
                'branch' => "汐止總公司",
            ]);
        }

        // MaaUser::create([
        //     'job_id' => '2140',
        //     'name' => '游中榮',
        //     'department' => '數位工程發展部',
        //     'branch' => '汐止總公司',
        // ]);
        // MaaUser::create([
        //     'job_id' => '3606',
        //     'name' => '徐旨暘',
        //     'department' => '數位工程發展部',
        //     'branch' => '汐止總公司',
        // ]);
        // MaaUser::create([
        //     'job_id' => '3520',
        //     'name' => '劉庭宇',
        //     'department' => '數位工程發展部',
        //     'branch' => '汐止總公司',
        // ]);
        // MaaUser::create([
        //     'job_id' => '3444',
        //     'name' => '陳禹伸',
        //     'department' => '數位工程發展部',
        //     'branch' => '汐止總公司',
        // ]);
        
    }
}