Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel invoice number generator

function invoiceNumber()
{
    $latest = AppOrder::latest()->first();

    if (! $latest) {
        return 'arm0001';
    }

    $string = preg_replace("/[^0-9.]/", '', $latest->invoice_number);

    return 'arm' . sprintf('%04d', $string+1);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #laravel #invoice #number #generator
ADD COMMENT
Topic
Name
4+7 =