archtechx / virtualcolumn

Eloquent Virtual Column package.
MIT License
70 stars 12 forks source link

Handle encrypted columns which are set to null #19

Closed 22Nick22 closed 5 months ago

22Nick22 commented 5 months ago

The PR solves an issue whereby if an encrypted virtual column is set to null a TypeError is thrown when accessing it:

local.ERROR: Stancl\Tenancy\Database\Models\Tenant::valueEncrypted(): Argument #1 ($value) must be of type string, null given, called in /var/www/html/vendor/stancl/virtualcolumn/src/VirtualColumn.php on line 48
stancl commented 5 months ago

Pulled this and tried undoing the change to see if the test fails — indeed it throws the exception you reported, so the change makes sense here.

Thanks for the fix + regression test!