Encrypting data with Laravel

Since Laravel 8.12 encryption is now a part of the model casts. There's no longer any need for traits to encrypt and decrypt.

In Laravel making a field encrypted is as easy as:

class User extends Model
{
    public $casts = [
        'critical_information' => 'encrypted',
    ];
}

Laravel can also handle JSON, arrays, and objects. Check the docs for more information.