Skip to content

Moemen12/ID-GENREATOR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ID-GENREATOR 😃

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 .

About

it generates an private id for database

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages