for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Gameap\Traits;
use Illuminate\Support\Facades\Crypt;
trait Encryptable
{
public function getAttribute($key)
$value = parent::getAttribute($key);
if (in_array($key, $this->encryptable)) {
try {
$value = Crypt::decrypt($value);
} catch (\Throwable $exception) {
$value = '';
}
return $value;
public function setAttribute($key, $value)
$value = Crypt::encrypt($value);
return parent::setAttribute($key, $value);