Support the ongoing development of →
Security Database Eloquent
Last updated 2 years ago.

Use Laravels Crypt::encrypt/decrypt with Eloquents setColAttribute/getColAttribute? :)

Last updated 2 years ago.

The above code works successfully, but it's a pain to implement. That was going to be my next question - what's the best way to transparently use MySQL encryption with Eloquent? Can't find any documentation on those 2 methods?

Last updated 2 years ago.

I'm looking for this as well.


Using Acessors and Mutators don't help you? I found it as the easy way to handle data modification when saving and reading from DB.


Its 2017 !

Is there any better way to do this yet ??

I'm in real need of this.


I just used an accessor:

# Controller
$model->fill([ 'password' => '12345' ]);

# Model
public function setPasswordAttribute($value)
    $this->attributes['password'] = DB::raw("AES_ENCRYPT('$value', 'some-key')");
Last updated 7 years ago.

Sign in to participate in this thread!


Your banner here too?

azcoppen azcoppen Joined 15 Mar 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.