Eloquent encrypted relationship possible? #48049
Unanswered
flashmediasolutions
asked this question in
Q&A
Replies: 1 comment
-
Yes, it's possible. Here's a how-to explanation. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Looking for any possible insight or help to understand what is possible within Laravel and using FilamentPHP for backend.
Here is an example scenario:
There is a
phoneNumber
model and astore
model.A
store
belongsTo
phoneNumbers
and aphoneNumber
hasMany
stores
I understand the traditional creation of foreign id's and relationships.
My issue is that, in this example, the phone numbers are not sensitive, but store details and the relationship between the store and phone number is.
Currently I encrypt the
phoneNumber
raw value in thestore
table. Then when I am pulling up the store, I decrypt thephoneNumber
and search in thephoneNumber
model to find the match.So in the
store
model instead of using:I use:
I want to obfuscate the relationship, between the store and phoneNumber, but maintain access to the eloquent query ability with the phone number and its relationships.
Is there any workaround for this?
Thanks for any insight!
Beta Was this translation helpful? Give feedback.
All reactions