DEV Community

Arman Rahman
Arman Rahman

Posted on

Store Encrypted Data on Database Without Any Package in Laravel

In some situations, we need to store some protected data on the database. so we can use the $casts property on a model for encrypted specific data. Just like this -

 protected $casts = [
        'yourColumnName' => 'encrypted',
 ];
Enter fullscreen mode Exit fullscreen mode

Just like this add this to your model where you are storing secure data. this will encrypt data while storing and decrypt while you using. you don't need to worry about that.

Top comments (0)