A drop in solution for eloquent implicit route model binding with hashid's
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.
composer require leuverink/eloquent-hashid-binding
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!