Filament handling encryption and decryption
When using the encrypted cast in a model, does filament handle the encryption and decryption states automatically, or do I have to do this manually? Do I have to do this myself, according to the Laravel documentation example for encrypting data?
https://laravel.com/docs/11.x/encryption#using-the-encrypter
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
9 Replies
No the cast should suffice since it's cast too and from, this works perfectly for me in filament and encrypts in the database perfectly.
I made a field encrypted with the model cast like this, but when I do this and try to edit something with that encrypted field I get an error back instead.
Oh, nvm... I viewd a old one that wasnt encrypted thats was I got the error
So you can write an getAttribute method which checks if it is encryped and if not it encrypts it
That’s true, I had some issues when creating seeders with the encrypted fields it does not work for some reason when I try to view them in the filament panel
It’ll be how they are being handled in the seeder if you are not using the models you need to ensure they are encrypted at store
This is how my factory and seeder looks like
Ah, its fixed lol
ok nvm ahha
Sorry for the ping
No problemo