Eloquent Hashid binding

A drop in solution for eloquent implicit route model binding with hashid's

View the Project on GitHub

Build Status Coverage Status Latest Stable Version Latest Unstable Version License


NOTE

The hashid route keys are encoded/decoded on the fly. You can drop this in any project without the need for migrations.

Obfuscated id’s are Unique for each model. So id 1 for App\User is encoded to a different string than id 1 for a different model.


Installation

composer require leuverink/eloquent-hashid-binding

Usage

Simply use the HashidBinding trait in your eloquent model and you’re good to go!

namespace App;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Leuverink\HashidBinding\HashidBinding;

class User extends Authenticatable
{
    use HashidBinding;

    //
}

That’s it!