mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
27 lines
473 B
PHP
27 lines
473 B
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Receipts\Services;
|
|
|
|
|
|
class GeneratesReceiptBillNo
|
|
{
|
|
|
|
|
|
private $receiptBillNoExists;
|
|
|
|
|
|
public function __construct(ChecksIfReceiptBillNoExists $receiptBillNoExists)
|
|
{
|
|
$this->receiptBillNoExists = $receiptBillNoExists;
|
|
}
|
|
|
|
|
|
|
|
public function execute(): int {
|
|
|
|
$code = mt_rand(100000001, 999999999);
|
|
return !$this->receiptBillNoExists->execute($code) ? $code : self::execute();
|
|
|
|
}
|
|
|
|
} |