dwightwatson / validating

Automatically validating Eloquent models for Laravel
MIT License
968 stars 76 forks source link

Add isEncryptedCastable #230

Open kiwina opened 3 years ago

kiwina commented 3 years ago

Need to add a check to getModelAttributes if the value is isEncryptedCastable

dwightwatson commented 3 years ago

Happy to review a PR with tests that covers this functionality. Unfortunately I'm not in a position to work on this feature at the moment.

kiwina commented 3 years ago

Will look into it i'm testing it at the moment to see if the implementation works properly or not, then i'll add some tests to it and make a PR currenty i have: if (method_exists($this, 'isEncryptedCastable') && $this->isEncryptedCastable($key)) { $attributes[$key] = $value; continue; } witch should work with older laravel versions

kiwina commented 3 years ago

so after a little further testing the code isn't really necessary for it to work but if there is custom setters the encrypted attribute its necessary for it to work

kiwina commented 3 years ago

I think i got it figured out now with the encryption so far none of my tests fail still a little testing to be done before i can make a pull request if (method_exists($this, 'isEncryptedCastable') && $this->isEncryptedCastable($key) && $this->getModel()->hasSetMutator($key)) { $attributes[$key] = $value; continue; }