PHPackages                             chistel/laravel-uniqueid - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. chistel/laravel-uniqueid

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

chistel/laravel-uniqueid
========================

Generate uniqueid when saving Eloquent models to be used as auth key and route key

1.0.0(6y ago)0426MITPHPPHP &gt;=7.1.3

Since Oct 13Pushed 6y agoCompare

[ Source](https://github.com/chistel/laravel-uniqueid)[ Packagist](https://packagist.org/packages/chistel/laravel-uniqueid)[ Docs](https://github.com/chistel/laravel-uniqueid)[ RSS](/packages/chistel-laravel-uniqueid/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

laravel-uniqueid is simliar to [Spatie Sluggable](https://github.com/spatie/laravel-sluggable) as it was mimicked from it.
==========================================================================================================================

[](#laravel-uniqueid-is-simliar-to-spatie-sluggable-as-it-was-mimicked-from-it)

but the difference is that it's meant to use unique string for model routes.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require chistel/laravel-uniqueid
```

Usage
-----

[](#usage)

Your Eloquent models should use the `Chistel\LaravelUniqueId\HasUniqueId` trait and the `Chistel\LaravelUniqueId\UniqueIdOptions` class.

The trait contains an abstract method `getUniqueIdOptions()` that you must implement yourself.

Here's an example of how to implement the trait:

```
