I have classic user id table where the primary key is BigIncrement.
I need to hide the id value from user. So my idea is to use hashIds packages. What I've done to mask the id is by creating mutator on id column:
public function getIdAttribute($id)
{
return Hashids::connection(User::class)->encode($id);
}
The masking working good, but problem happens when I try to login. Seems the login session is not created.
My questions are:
- Why the login is failed after creating id mutator? I assume that to create session it involve the id value
- Any better way to mask the id, besides using mutator?