2016-05-20 08:57:45 +02:00
|
|
|
<?php
|
2016-05-20 12:41:23 +02:00
|
|
|
/**
|
|
|
|
* AccountMeta.php
|
|
|
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
|
|
*
|
2016-10-05 06:52:15 +02:00
|
|
|
* This software may be modified and distributed under the terms of the
|
|
|
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
|
|
|
*
|
|
|
|
* See the LICENSE file for details.
|
2016-05-20 12:41:23 +02:00
|
|
|
*/
|
|
|
|
|
2016-05-20 08:57:45 +02:00
|
|
|
declare(strict_types = 1);
|
|
|
|
|
|
|
|
namespace FireflyIII\Models;
|
2015-02-06 04:52:16 +01:00
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2016-04-06 09:27:45 +02:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
2015-02-06 04:52:16 +01:00
|
|
|
|
2015-02-11 07:35:10 +01:00
|
|
|
/**
|
2016-01-01 21:49:27 +01:00
|
|
|
* FireflyIII\Models\AccountMeta
|
2015-02-11 07:35:10 +01:00
|
|
|
*
|
2016-01-28 22:06:16 +01:00
|
|
|
* @property integer $id
|
|
|
|
* @property \Carbon\Carbon $created_at
|
|
|
|
* @property \Carbon\Carbon $updated_at
|
|
|
|
* @property integer $account_id
|
|
|
|
* @property string $name
|
|
|
|
* @property string $data
|
|
|
|
* @property-read Account $account
|
2016-03-12 07:36:23 +01:00
|
|
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereId($value)
|
|
|
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereCreatedAt($value)
|
|
|
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereUpdatedAt($value)
|
|
|
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereAccountId($value)
|
|
|
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereName($value)
|
|
|
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereData($value)
|
|
|
|
* @mixin \Eloquent
|
2015-02-11 07:35:10 +01:00
|
|
|
*/
|
2015-02-06 05:04:06 +01:00
|
|
|
class AccountMeta extends Model
|
|
|
|
{
|
2015-02-06 04:52:16 +01:00
|
|
|
|
2016-01-15 23:12:52 +01:00
|
|
|
protected $dates = ['created_at', 'updated_at'];
|
2015-02-23 21:19:16 +01:00
|
|
|
protected $fillable = ['account_id', 'name', 'data'];
|
2015-06-06 23:09:12 +02:00
|
|
|
protected $table = 'account_meta';
|
2015-02-14 14:25:29 +01:00
|
|
|
|
2015-02-11 07:35:10 +01:00
|
|
|
/**
|
2015-05-10 13:22:00 +02:00
|
|
|
*
|
2016-04-06 09:27:45 +02:00
|
|
|
* @return BelongsTo
|
2015-02-11 07:35:10 +01:00
|
|
|
*/
|
2016-04-06 09:27:45 +02:00
|
|
|
public function account(): BelongsTo
|
2015-02-06 05:04:06 +01:00
|
|
|
{
|
2015-02-06 05:35:00 +01:00
|
|
|
return $this->belongsTo('FireflyIII\Models\Account');
|
2015-02-06 05:04:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-11 07:35:10 +01:00
|
|
|
/**
|
|
|
|
* @param $value
|
|
|
|
*
|
|
|
|
* @return mixed
|
|
|
|
*/
|
2015-02-06 05:04:06 +01:00
|
|
|
public function getDataAttribute($value)
|
|
|
|
{
|
|
|
|
return json_decode($value);
|
|
|
|
}
|
|
|
|
|
2015-02-11 07:35:10 +01:00
|
|
|
/**
|
|
|
|
* @param $value
|
|
|
|
*/
|
2015-02-07 13:15:40 +01:00
|
|
|
public function setDataAttribute($value)
|
|
|
|
{
|
|
|
|
$this->attributes['data'] = json_encode($value);
|
|
|
|
}
|
|
|
|
|
2015-02-06 04:52:16 +01:00
|
|
|
}
|