<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class AccountSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $accounts = [
            ['code' => '101', 'name' => 'Kas', 'type' => 'Asset'],
            ['code' => '102', 'name' => 'Persediaan Barang Dagang', 'type' => 'Asset'],
            ['code' => '301', 'name' => 'Modal', 'type' => 'Equity'],
            ['code' => '401', 'name' => 'Penjualan', 'type' => 'Revenue'],
            ['code' => '501', 'name' => 'Harga Pokok Penjualan', 'type' => 'Expense'],
            ['code' => '502', 'name' => 'Biaya Operasional', 'type' => 'Expense'],
        ];

        foreach ($accounts as $account) {
            \App\Models\Account::updateOrCreate(
                ['code' => $account['code']],
                $account
            );
        }
    }
}
