saade-package/generate-unique-id

A package to generate unique ID

v1.0.0 2023-03-26 16:14 UTC

This package is not auto-updated.

Last update: 2025-08-12 01:50:51 UTC


README

it generates an private id for database

This code is using in laravel application to generate an unique id and also it will check if the generated id

is the same in database it will generate a new . 😉

Installing :

composer require saade-package/generate-unique-id

Now how to use it ?

For example if you created an id-generator column in post table, you can make an private id to the post like this :

    public function store(Request $request){

        DB::table('generated_id')->insert([
            'generatedID'=>generateUniqueId('generatedIdTable','generatedIdColumn')
        ]);

    }
Option Description
table name (string & require) it is the table name where You want to insert the data in it.
column name (string & require) it is the table column where You want to insert the data in it.

The generate function generateUniqueId function takes 2 arguments , the first argument is the Table name and

the second argument is the column name where you want to insert the uniqueId .

Here this code will generate an id from 25 characters and inserts it in database .