Optimized preferences.

This commit is contained in:
James Cole
2015-06-03 21:58:06 +02:00
parent 1240c8f685
commit 14dce8a10b
4 changed files with 36 additions and 49 deletions

View File

@@ -55,21 +55,6 @@ class Preference extends Model
return ['created_at', 'updated_at'];
}
/**
* @param $value
*
* @return float|int
*/
public function getNameAttribute($value)
{
if (is_null($this->name_encrypted)) {
return $value;
}
$value = Crypt::decrypt($this->name_encrypted);
return $value;
}
/**
* @param $value
*/
@@ -79,15 +64,6 @@ class Preference extends Model
$this->attributes['data_encrypted'] = Crypt::encrypt(json_encode($value));
}
/**
* @param $value
*/
public function setNameAttribute($value)
{
$this->attributes['name_encrypted'] = Crypt::encrypt($value);
$this->attributes['name'] = $value;
}
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/