2017 © Pedro Peláez
 

library unique-hashids

Easily create unique ids for a Laravel model.

image

juggl/unique-hashids

Easily create unique ids for a Laravel model.

  • Wednesday, January 20, 2016
  • by svenluijten
  • Repository
  • 1 Watchers
  • 2 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

THIS VERSION IS DEPRECATED! PLEASE USE sven/unique-hashids INSTEAD., (*1)

Unique Hashids

Latest Version on Packagist Total Downloads ![Software License][ico-license], (*2)

This is a simple trait for Laravel models to generate unique ids for them. It uses vinkla's wonderful Hashids package and is configurable within the model itself., (*3)

Installation

You may install this package via composer:, (*4)

$ composer require juggl/unique-hashids

Configuration

This will install both this package and Hashids. Please see the documentation over there to install & configure the hashids. This package will use the default Hashids driver., (*5)

Usage

To start generating unique ids for your models, all you need to do is use a trait, like so:, (*6)

namespace App;

use Juggl\UniqueHashids\GeneratesUnique;
use Illuminate\Database\Eloquent\Model;

class YourModel extends Model
{
    use GeneratesUnique;

    // The rest of your model
}

By default, this package assumes you have a unique_id column on you database to store the unique id in. Optionally, you may override this by setting a static property $uniqueColumn on your model:, (*7)

namespace App;

use Juggl\UniqueHashids\GeneratesUnique;
use Illuminate\Database\Eloquent\Model;

class YourModel extends Model
{
    use GeneratesUnique;

    public static $uniqueColumn = 'my_column'; // this will assume 'unique_id' by default.

    // The rest of your model
}

Credits

This package depends on vinkla's excellent Hashids package, found here., (*8)

License

juggl\unique-hashids is licenced under the MIT License (MIT). Please see the license file for more information., (*9)

The Versions

20/01 2016

dev-master

9999999-dev https://github.com/Jugglio/UniqueHashids

Easily create unique ids for a Laravel model.

  Sources   Download

MIT

The Requires

 

laravel unique id hashids unique id

26/12 2015

1.1.0

1.1.0.0 https://github.com/Jugglio/UniqueHashids

Easily create unique ids for a Laravel model.

  Sources   Download

MIT

The Requires

 

laravel unique id hashids unique id

24/12 2015

1.0.0

1.0.0.0 https://github.com/Jugglio/UniqueHashids

Easily create unique ids for a Laravel model.

  Sources   Download

MIT

The Requires

 

laravel unique id hashids unique id