<?php

namespace Modules\Patient\Models\Traits;

use Modules\Patient\Models\ZakatFund;

trait GenerateZakatCodeTraits
{
     protected function generateZakatCode(): string
    {
        do {
            $code = 'ZAK-' . random_int(100000, 999999);
        } while (ZakatFund::where('code', $code)->exists());

        return $code;
    }
}
