Laravel Pro Tips
You can encrypt and decrypt model attributes with casting.
When casting "encrypted", Laravel will decrypt the value on retrieval and encrypt it when saving.
Laravel Tip: If we want to put "sensitive" data in our DB then we can use Crypt Facade and handle these using accessors and mutators.
Jun 30th, 2022
Generating a secure encryption key for a custom Eloquent model cast
Yesterday, I posted a tip on Twitter about using a custom Eloquent attribute cast to handle encryption. Doing this, allows you to use a custom key per model, which can increase the security of your...