myopensoft / runner
Running number manager by using database storage
1.1.11
2024-07-12 03:00 UTC
Requires
- php: ^7.1|^8.0
- laravel/framework: ^5.4.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
README
To generate running number that managed by database as a storage. For Laravel 5.4+, 6.0+
Installation
composer require myopensoft/runner
php artisan migrate
use MyOpensoft\Runner\Runner;
Generate number
- There will be 5 indexed rule (
{rule_1}
...{rule_5}
) and 2 non-indexed rule ({n_rule_1}
and{n_rule_2}
). {raw}
will get raw number.{p_raw,<number>}
will generate left padding from raw number.
// generate TTFN-WPPJ-(P)-000001-2020
Runner::generate("{rule_1}-{rule_2}-{n_rule_1}-{p_raw,6}-{rule_3}", "TTFM", "WPPJ", 2020, null, null, '(P)');
// generate T20022200001 | T 20 02 22 00001
Runner::generate("{rule_1}{rule_2}{rule_3}{rule_4}{p_raw,5}", "T", '20', '02', '22');
TODO
- Test script