{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/ideas/issues/1216","repository_url":"https://api.github.com/repos/laravel/ideas","labels_url":"https://api.github.com/repos/laravel/ideas/issues/1216/labels{/name}","comments_url":"https://api.github.com/repos/laravel/ideas/issues/1216/comments","events_url":"https://api.github.com/repos/laravel/ideas/issues/1216/events","html_url":"https://github.com/laravel/ideas/issues/1216","id":331246557,"node_id":"MDU6SXNzdWUzMzEyNDY1NTc=","number":1216,"title":"[ELOQUENT]: Accessors should work while searching","user":{"login":"cozylife","id":8941225,"node_id":"MDQ6VXNlcjg5NDEyMjU=","avatar_url":"https://avatars0.githubusercontent.com/u/8941225?v=4","gravatar_id":"","url":"https://api.github.com/users/cozylife","html_url":"https://github.com/cozylife","followers_url":"https://api.github.com/users/cozylife/followers","following_url":"https://api.github.com/users/cozylife/following{/other_user}","gists_url":"https://api.github.com/users/cozylife/gists{/gist_id}","starred_url":"https://api.github.com/users/cozylife/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cozylife/subscriptions","organizations_url":"https://api.github.com/users/cozylife/orgs","repos_url":"https://api.github.com/users/cozylife/repos","events_url":"https://api.github.com/users/cozylife/events{/privacy}","received_events_url":"https://api.github.com/users/cozylife/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-06-11T15:49:30Z","updated_at":"2018-06-11T16:22:39Z","closed_at":"2018-06-11T16:21:27Z","author_association":"NONE","body":"I have several [accessors](https://laravel.com/docs/5.6/eloquent-mutators#defining-an-accessor) set up to decrypt encrypted DB fields. However, I'm unable to search those fields unless I encrypt the search data first.\r\n\r\nThe thing is, I use Laravel Spark, and other third-party software which I'm unable to modify the code for obvious reasons. If I encrypt the \"email\" field on the \"users\" table, for instance, then certain things like logging in doesn't work anymore because of the fact that Laravel looks for an unencrypted email field using `where()`.\r\n\r\nAs `where()` and other lookup methods (Ex. `firstOrCreate()`) already collect the column names, it'll be really simple to apply the same code that checks if a column has an accessor, and then if it does, just apply the mutator to the data before searching."},"comment":{"url":"https://api.github.com/repos/laravel/ideas/issues/comments/396301864","html_url":"https://github.com/laravel/ideas/issues/1216#issuecomment-396301864","issue_url":"https://api.github.com/repos/laravel/ideas/issues/1216","id":396301864,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NjMwMTg2NA==","user":{"login":"staudenmeir","id":1853169,"node_id":"MDQ6VXNlcjE4NTMxNjk=","avatar_url":"https://avatars3.githubusercontent.com/u/1853169?v=4","gravatar_id":"","url":"https://api.github.com/users/staudenmeir","html_url":"https://github.com/staudenmeir","followers_url":"https://api.github.com/users/staudenmeir/followers","following_url":"https://api.github.com/users/staudenmeir/following{/other_user}","gists_url":"https://api.github.com/users/staudenmeir/gists{/gist_id}","starred_url":"https://api.github.com/users/staudenmeir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/staudenmeir/subscriptions","organizations_url":"https://api.github.com/users/staudenmeir/orgs","repos_url":"https://api.github.com/users/staudenmeir/repos","events_url":"https://api.github.com/users/staudenmeir/events{/privacy}","received_events_url":"https://api.github.com/users/staudenmeir/received_events","type":"User","site_admin":false},"created_at":"2018-06-11T16:22:39Z","updated_at":"2018-06-11T16:22:39Z","author_association":"NONE","body":"As @36864 said, what you are asking is not possible. When you call `encrypt()` with the same data multiple times, it will always create a different result. So you can't look for the encrypted value in the database."}}
{"actor":{"display_login":"staudenmeir"}}