mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Expand models.
This commit is contained in:
@@ -16,13 +16,13 @@ class AccountMeta extends Ardent
|
||||
= [
|
||||
'account_id' => 'numeric|required|exists:accounts,id',
|
||||
'name' => 'required|between:1,250',
|
||||
'data' => 'required'];
|
||||
|
||||
'data' => 'required'
|
||||
];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['account_id', 'name', 'date'];
|
||||
|
||||
protected $table = 'account_meta';
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
@@ -32,4 +32,22 @@ class AccountMeta extends Ardent
|
||||
return $this->belongsTo('Account');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDataAttribute($value)
|
||||
{
|
||||
return json_decode($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*/
|
||||
public function setDataAttribute($value)
|
||||
{
|
||||
$this->attributes['data'] = json_encode($value);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user