PHP code example of helmab / model-unique-code

1. Go to this page and download the library: Download helmab/model-unique-code 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/ */

    

helmab / model-unique-code example snippets




namespace App\Models;

use Helmab\ModelUniqueCode\Traits\HasModelUniqueCode;
use Illuminate\Database\Eloquent\Model;

class Invoice extends Model
{
    use HasModelUniqueCode;
    
    protected $key_unique_code = 'code'; // default
    
    protected $length_unique_code = 8; // default
    
    protected $prefix_unique_code = "INV"; // random
    
    protected $type_unique_code = "number"; // number, string, mixed
    
    protected $has_prefix_unique_code = false; // default

    protected $fillable = [
        'code',
    ];
}