helmab / model-unique-code
Generate unique code for Laravel Model
v1.0.0
2022-04-30 07:13 UTC
Requires
- php: ^7.1|^7.4|^8.0
- illuminate/support: ^5.0 || ^6.0 || ^7.0 || ^8.0
This package is auto-updated.
Last update: 2024-10-29 06:19:20 UTC
README
Generate unique code for Laravel Model. Example INV-96752304
Installation
You can install the package via composer:
composer require helmab/model-unique-code
Usage
<?php 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', ]; }
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email mabhelitc@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.