<?php

namespace App\Validator;

use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\ValidationException;

class JurnalValidator
{
    public static function validate(array $data)
    {
        $validator = Validator::make($data, [
            'trans_id' => 'required|string',
            'trans_kode' => 'required|string',
            'akun_jurnal' => 'required|string',
            'debet' => 'integer',
            'kredit' => 'integer',
            'keterangan' => 'nullable|string',
            'trans_tglbuku' => 'required|date'
        ]);
        if ($validator->fails()) {
            throw new ValidationException($validator);
        }
    }
}
