Search
 
SCRIPT & CODE EXAMPLE
 

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);
}
Comment

PREVIOUS NEXT
Code Example
Php :: laravel eloquent group by week 
Php :: why does php syntax doesnt work in my html 
Php :: laravel: get last id 
Php :: Object of class IlluminateDatabaseEloquentBuilder could not be converted to string 
Php :: validation file in laravel 
Php :: laravel create mode 
Php :: laravel store array to cache 
Php :: php check if query succeeded 
Php :: laravel set a session variable 
Php :: php artisan serve on lumen 
Php :: laravel check if item is in collection 
Php :: input file accept jpg jpeg png php 
Php :: cronjob php linux 
Php :: execute php in terminal 
Php :: php variable in echo 
Php :: eloquent unique combination 
Php :: php camelcase to snake case 
Php :: laravel local file storage 
Php :: laravel validate date 
Php :: docker php 7.2 add ext-mongodb 
Php :: php combine values of two arrays 
Php :: laravel query foreach 
Php :: how to print string plus variable in php 
Php :: carbon greater than 
Php :: pass image path in laravel blade 
Php :: how to remove duplicate values from a multidimensional array in php 
Php :: how to download image from url from a particular div in php 
Php :: livewire datatable Delete column momentarily triggering confirmation dialog of last row during page load 
Php :: include() in php 
Php :: Termlaravel validation exists array data 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =