3.2.5 will once again be capable of encrypting journal descriptions (and more, in the future).

This commit is contained in:
James Cole 2015-01-29 05:23:31 +01:00
parent f89aee37f5
commit 5aa1db293f
2 changed files with 24 additions and 0 deletions

View File

@ -49,6 +49,15 @@ class ChangesFor325 extends Migration
// don't care either.
}
// allow journal descriptions to be encrypted.
Schema::table(
'transaction_journals', function (Blueprint $table) {
$table->boolean('encrypted');
}
);
DB::update('ALTER TABLE `transaction_journals` MODIFY `description` VARCHAR(1024)');
}
}

View File

@ -82,6 +82,15 @@ class TransactionJournal extends Eloquent
return ['created_at', 'updated_at', 'date'];
}
public function getDescriptionAttribute($value)
{
if ($this->encrypted) {
return Crypt::decrypt($value);
}
return $value;
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
@ -198,6 +207,12 @@ class TransactionJournal extends Eloquent
);
}
public function setDescriptionAttribute($value)
{
$this->attributes['description'] = Crypt::encrypt($value);
$this->attributes['encrypted'] = true;
}
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/