class Profile extends Eloquent {
protected $fillable = array('name', 'last_name', 'website', 'facebook', 'twitter', 'linkedin', 'google_plus');
public static function boot(){
parent::boot();
self::updating(function($model){
$model->name = Crypt::encrypt($model->name);
$model->last_name = Crypt::encrypt($model->last_name);
$model->facebook = Crypt::encrypt($model->facebook);
$model->twitter = Crypt::encrypt($model->twitter);
$model->linkedin = Crypt::encrypt($model->linkedin);
$model->website = Crypt::encrypt($model->website);
$model->google_plus = Crypt::encrypt($model->google_plus);
});
}
}
I'm using too call the event..
$user->profile()->update(array(
'name' => e($input['name']),
'last_name' => e($input['last_name']),
'website' => e($input['website']),
'facebook' => e($input['facebook']),
'twitter' => e($input['twitter']),
'linkedin' => e($input['linkedin']),
'google_plus' => e($input['google_plus'])
));
For some reason, it's not triggering any of the events... I'm trying to encrypt the user information before saving it to the database