Store Encrypted Data on Database Without Any Package in Laravel

Arman Rahman - Sep 13 '23 - - Dev Community

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.

. . . . . . . . . . . . . . . . . . . . . . . .