Accounts can now have IBAN.

This commit is contained in:
James Cole
2015-07-03 12:51:14 +02:00
parent 854368a8f3
commit d8b65f62e7
12 changed files with 92 additions and 52 deletions

View File

@@ -47,6 +47,9 @@ use Watson\Validating\ValidatingTrait;
* @property mixed piggyBalance
* @property mixed difference
* @property mixed percentage
* @property string $iban
* @property-read mixed $name_for_editform
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereIban($value)
*/
class Account extends Model
{
@@ -143,6 +146,22 @@ class Account extends Model
return ['created_at', 'updated_at', 'deleted_at'];
}
/**
* @codeCoverageIgnore
*
* @param $value
*
* @return string
*/
public function getIbanAttribute($value)
{
if (is_null($value)) {
return null;
}
return Crypt::decrypt($value);
}
/**
*
* @param string $fieldName
@@ -236,6 +255,16 @@ class Account extends Model
$query->where($joinName . '.data', json_encode($value));
}
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setIbanAttribute($value)
{
$this->attributes['iban'] = Crypt::encrypt($value);
}
/**
* @codeCoverageIgnore
*