andersao / andersao/l5-repository

Search with Hashed IDs

Open
#427 2 comments 0 reactions 0 assignees View on GitHub
idea
Dominant language
PHP
Stars
4.2k
Forks
880
PR merge metrics
No merged PRs in 30d

Description

Hey @andersao , @eullercdr and community,

thanks for this awesome package.
Recently, I stumbled upon the following problem with my application:
I have a route that enables users to retrieve `Projects`. By using your package, the user is able to search within the resultset for a specific `Project` based on several properties. The `$fieldsSearchable` are correctly defined in my `ProjectRepository`. Please note that this already works as expected.

In order to "hide" the real IDs of my entities, I use `vinkla/laravel-hashids` ([github](https://github.com/vinkla/laravel-hashids)). Basically, the IDs gets encoded..

However, if I try to search by a respective ID of a `Project`, I would like to use a query like this:
```
GET /projects?search=id:a7893bada
```
with the encoded ID. This does not work - because your package works on the `real` IDs and not on the hashed ones.

If you agree that this might be a problem, I could provide a configurable PR in order to fix it easily.
What do you think? I would appreciate your feedback!

Cheers

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.