. */ declare(strict_types=1); namespace FireflyIII\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; /** * Class AccountMeta. */ class AccountMeta extends Model { /** * The attributes that should be casted to native types. * * @var array */ protected $casts = [ 'created_at' => 'datetime', 'updated_at' => 'datetime', ]; /** @var array */ protected $fillable = ['account_id', 'name', 'data']; /** * @var string */ protected $table = 'account_meta'; /** * @return BelongsTo * @codeCoverageIgnore */ public function account(): BelongsTo { return $this->belongsTo('FireflyIII\Models\Account'); } /** * @param $value * * @codeCoverageIgnore * @return mixed */ public function getDataAttribute($value) { return json_decode($value); } /** * @param $value * * @codeCoverageIgnore */ public function setDataAttribute($value) { $this->attributes['data'] = json_encode($value); } }