<?php

namespace App\Modules\PaymentPurposeCode\Database\Seeders;

use App\Modules\PaymentPurposeCode\Models\PaymentPurposeCode;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\File;

class PaymentPurposeCodeSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $data = collect(File::json(__DIR__.'/../../Resources/Data/data.json'));

        $data->each(function ($item) {
            PaymentPurposeCode::create(['code' => $item['key'], 'name' => $item['value']]);
        });
    }
}
