lyrasoft/sequence

LYRASOFT sequence package.

Installs: 1 806

Dependents: 2

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 0

Open Issues: 0

Type:windwalker-package

1.0.1 2023-11-12 08:23 UTC

This package is auto-updated.

Last update: 2024-11-12 10:28:58 UTC


README

To get unique serial numbers for any record.

Installation

Install from composer

composer require lyrasoft/sequence

Then copy files to project

php windwalker pkg:install lyrasoft/sequence -t migrations

You must manually add SequencePackage::class to etc/di.php

// ...

    'providers' => [
        \Lyrasoft\Sequence\SequencePackage::class
    ],

// ...

Usage

$sequenceServcie = $app->service(\Lyrasoft\Sequence\Service\SequenceService::class);

$serial = $sequenceServcie->getNextSerial('order', 'FN-'); // 15
$serial = $sequenceServcie->getNextSerialAndPadZero('order', 'FN-', 7); // 0000015
$serial = $sequenceServcie->getNextSerialWithPrefix('order', 'FN-', 7); // FN-0000015