PHP code example of devaspid / laravel-id-generator
1. Go to this page and download the library: Download devaspid/laravel-id-generator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Illuminate\Support\Facades\DB;
use Devaspid\LaravelIdGenerator\Facades\IdGenerator;
DB::transaction(function () use ($request) {
$invoice = new Invoice($request->validated());
$invoice->number = IdGenerator::generate('invoice');
$invoice->save();
});
use Devaspid\LaravelIdGenerator\Facades\IdGenerator;
$number = IdGenerator::generate('invoice');