mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 19:01:58 +00:00
Clean up lots of models.
This commit is contained in:
@@ -36,12 +36,25 @@ class Account extends Model
|
|||||||
{
|
{
|
||||||
use SoftDeletes, ValidatingTrait;
|
use SoftDeletes, ValidatingTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'deleted_at' => 'date',
|
||||||
|
'active' => 'boolean',
|
||||||
|
'encrypted' => 'boolean',
|
||||||
|
];
|
||||||
/** @var array */
|
/** @var array */
|
||||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||||
/** @var array */
|
/** @var array */
|
||||||
protected $fillable = ['user_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];
|
protected $fillable = ['user_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];
|
||||||
/** @var array */
|
/** @var array */
|
||||||
protected $hidden = ['virtual_balance_encrypted', 'encrypted'];
|
protected $hidden = ['encrypted'];
|
||||||
protected $rules
|
protected $rules
|
||||||
= [
|
= [
|
||||||
'user_id' => 'required|exists:users,id',
|
'user_id' => 'required|exists:users,id',
|
||||||
@@ -184,7 +197,7 @@ class Account extends Model
|
|||||||
public function getNameAttribute($value): string
|
public function getNameAttribute($value): string
|
||||||
{
|
{
|
||||||
|
|
||||||
if (intval($this->encrypted) == 1) {
|
if ($this->encrypted) {
|
||||||
return Crypt::decrypt($value);
|
return Crypt::decrypt($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,6 +24,17 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||||||
class AccountMeta extends Model
|
class AccountMeta extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
];
|
||||||
|
/** @var array */
|
||||||
protected $dates = ['created_at', 'updated_at'];
|
protected $dates = ['created_at', 'updated_at'];
|
||||||
protected $fillable = ['account_id', 'name', 'data'];
|
protected $fillable = ['account_id', 'name', 'data'];
|
||||||
protected $table = 'account_meta';
|
protected $table = 'account_meta';
|
||||||
|
@@ -33,6 +33,18 @@ class AccountType extends Model
|
|||||||
const IMPORT = 'Import account';
|
const IMPORT = 'Import account';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
];
|
||||||
|
|
||||||
|
/** @var array */
|
||||||
protected $dates = ['created_at', 'updated_at'];
|
protected $dates = ['created_at', 'updated_at'];
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@@ -29,6 +29,21 @@ class Attachment extends Model
|
|||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'deleted_at' => 'date',
|
||||||
|
'uploaded' => 'boolean',
|
||||||
|
];
|
||||||
|
/** @var array */
|
||||||
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||||
|
/** @var array */
|
||||||
protected $fillable = ['attachable_id', 'attachable_type', 'user_id', 'md5', 'filename', 'mime', 'title', 'notes', 'description', 'size', 'uploaded'];
|
protected $fillable = ['attachable_id', 'attachable_type', 'user_id', 'md5', 'filename', 'mime', 'title', 'notes', 'description', 'size', 'uploaded'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -27,10 +27,24 @@ class AvailableBudget extends Model
|
|||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
/** @var array */
|
/** @var array */
|
||||||
protected $dates = ['created_at', 'updated_at', 'deleted_at', 'start_date', 'end_date'];
|
|
||||||
/** @var array */
|
|
||||||
protected $fillable = ['user_id', 'transaction_currency_id', 'amount', 'start_date', 'end_date'];
|
protected $fillable = ['user_id', 'transaction_currency_id', 'amount', 'start_date', 'end_date'];
|
||||||
|
|
||||||
|
/** @var array */
|
||||||
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'deleted_at' => 'date',
|
||||||
|
'start_date' => 'date',
|
||||||
|
'end_date' => 'date',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||||
*/
|
*/
|
||||||
|
@@ -29,8 +29,26 @@ class Bill extends Model
|
|||||||
{
|
{
|
||||||
|
|
||||||
use ValidatingTrait;
|
use ValidatingTrait;
|
||||||
|
/** @var array */
|
||||||
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||||
|
|
||||||
protected $dates = ['created_at', 'updated_at', 'date'];
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'deleted_at' => 'date',
|
||||||
|
'date' => 'date',
|
||||||
|
'skip' => 'int',
|
||||||
|
'automatch' => 'boolean',
|
||||||
|
'active' => 'boolean',
|
||||||
|
'name_encrypted' => 'boolean',
|
||||||
|
'match_encrypted' => 'boolean',
|
||||||
|
];
|
||||||
protected $fillable
|
protected $fillable
|
||||||
= ['name', 'match', 'amount_min', 'match_encrypted', 'name_encrypted', 'user_id', 'amount_max', 'date', 'repeat_freq', 'skip',
|
= ['name', 'match', 'amount_min', 'match_encrypted', 'name_encrypted', 'user_id', 'amount_max', 'date', 'repeat_freq', 'skip',
|
||||||
'automatch', 'active',];
|
'automatch', 'active',];
|
||||||
|
@@ -30,7 +30,23 @@ class Budget extends Model
|
|||||||
|
|
||||||
use SoftDeletes, ValidatingTrait;
|
use SoftDeletes, ValidatingTrait;
|
||||||
|
|
||||||
protected $dates = ['created_at', 'updated_at', 'deleted_at', 'startdate', 'enddate'];
|
/** @var array */
|
||||||
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'deleted_at' => 'date',
|
||||||
|
'active' => 'boolean',
|
||||||
|
'encrypted' => 'boolean',
|
||||||
|
];
|
||||||
|
|
||||||
protected $fillable = ['user_id', 'name', 'active'];
|
protected $fillable = ['user_id', 'name', 'active'];
|
||||||
protected $hidden = ['encrypted'];
|
protected $hidden = ['encrypted'];
|
||||||
protected $rules = ['name' => 'required|between:1,200',];
|
protected $rules = ['name' => 'required|between:1,200',];
|
||||||
@@ -95,7 +111,7 @@ class Budget extends Model
|
|||||||
public function getNameAttribute($value)
|
public function getNameAttribute($value)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (intval($this->encrypted) == 1) {
|
if ($this->encrypted) {
|
||||||
return Crypt::decrypt($value);
|
return Crypt::decrypt($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,8 +131,8 @@ class Budget extends Model
|
|||||||
*/
|
*/
|
||||||
public function setNameAttribute($value)
|
public function setNameAttribute($value)
|
||||||
{
|
{
|
||||||
$this->attributes['name'] = Crypt::encrypt($value);
|
$this->attributes['name'] = $value;
|
||||||
$this->attributes['encrypted'] = true;
|
$this->attributes['encrypted'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -23,7 +23,20 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
class BudgetLimit extends Model
|
class BudgetLimit extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $dates = ['created_at', 'updated_at', 'startdate'];
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'startdate' => 'date',
|
||||||
|
'repeats' => 'boolean',
|
||||||
|
];
|
||||||
|
/** @var array */
|
||||||
|
protected $dates = ['created_at', 'updated_at'];
|
||||||
protected $hidden = ['amount_encrypted'];
|
protected $hidden = ['amount_encrypted'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -29,10 +29,26 @@ class Category extends Model
|
|||||||
{
|
{
|
||||||
use SoftDeletes, ValidatingTrait;
|
use SoftDeletes, ValidatingTrait;
|
||||||
|
|
||||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'deleted_at' => 'date',
|
||||||
|
'encrypted' => 'boolean',
|
||||||
|
];
|
||||||
|
/** @var array */
|
||||||
protected $fillable = ['user_id', 'name'];
|
protected $fillable = ['user_id', 'name'];
|
||||||
|
/** @var array */
|
||||||
protected $hidden = ['encrypted'];
|
protected $hidden = ['encrypted'];
|
||||||
|
/** @var array */
|
||||||
protected $rules = ['name' => 'required|between:1,200',];
|
protected $rules = ['name' => 'required|between:1,200',];
|
||||||
|
/** @var array */
|
||||||
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $fields
|
* @param array $fields
|
||||||
@@ -86,7 +102,7 @@ class Category extends Model
|
|||||||
public function getNameAttribute($value)
|
public function getNameAttribute($value)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (intval($this->encrypted) == 1) {
|
if ($this->encrypted) {
|
||||||
return Crypt::decrypt($value);
|
return Crypt::decrypt($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,8 +115,8 @@ class Category extends Model
|
|||||||
*/
|
*/
|
||||||
public function setNameAttribute($value)
|
public function setNameAttribute($value)
|
||||||
{
|
{
|
||||||
$this->attributes['name'] = Crypt::encrypt($value);
|
$this->attributes['name'] = $value;
|
||||||
$this->attributes['encrypted'] = true;
|
$this->attributes['encrypted'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -25,6 +25,17 @@ class Configuration extends Model
|
|||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
];
|
||||||
|
/** @var array */
|
||||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||||
protected $table = 'configuration';
|
protected $table = 'configuration';
|
||||||
|
|
||||||
|
@@ -23,6 +23,15 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
*/
|
*/
|
||||||
class ExportJob extends Model
|
class ExportJob extends Model
|
||||||
{
|
{
|
||||||
|
/** @var array */
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
];
|
||||||
|
/** @var array */
|
||||||
|
protected $dates = ['created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $value
|
* @param $value
|
||||||
*
|
*
|
||||||
|
@@ -27,6 +27,19 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
class ImportJob extends Model
|
class ImportJob extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
];
|
||||||
|
/** @var array */
|
||||||
|
protected $dates = ['created_at', 'updated_at'];
|
||||||
|
|
||||||
protected $validStatus
|
protected $validStatus
|
||||||
= [
|
= [
|
||||||
'import_status_never_started', // initial state
|
'import_status_never_started', // initial state
|
||||||
|
@@ -26,6 +26,18 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
class LimitRepetition extends Model
|
class LimitRepetition extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'startdate' => 'date',
|
||||||
|
'enddate' => 'date',
|
||||||
|
];
|
||||||
protected $dates = ['created_at', 'updated_at', 'startdate', 'enddate'];
|
protected $dates = ['created_at', 'updated_at', 'startdate', 'enddate'];
|
||||||
protected $hidden = ['amount_encrypted'];
|
protected $hidden = ['amount_encrypted'];
|
||||||
|
|
||||||
|
@@ -23,10 +23,20 @@ use League\CommonMark\CommonMarkConverter;
|
|||||||
*/
|
*/
|
||||||
class Note extends Model
|
class Note extends Model
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'deleted_at' => 'date',
|
||||||
|
];
|
||||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||||
protected $fillable = ['title', 'text'];
|
protected $fillable = ['title', 'text'];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@@ -29,9 +29,24 @@ class PiggyBank extends Model
|
|||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'deleted_at' => 'date',
|
||||||
|
'startdate' => 'date',
|
||||||
|
'targetdate' => 'date',
|
||||||
|
'order' => 'int',
|
||||||
|
'active' => 'boolean',
|
||||||
|
'encrypted' => 'boolean',
|
||||||
|
];
|
||||||
protected $dates = ['created_at', 'updated_at', 'deleted_at', 'startdate', 'targetdate'];
|
protected $dates = ['created_at', 'updated_at', 'deleted_at', 'startdate', 'targetdate'];
|
||||||
protected $fillable
|
protected $fillable = ['name', 'account_id', 'order', 'targetamount', 'startdate', 'targetdate'];
|
||||||
= ['name', 'account_id', 'order', 'targetamount', 'startdate', 'targetdate'];
|
|
||||||
protected $hidden = ['targetamount_encrypted', 'encrypted'];
|
protected $hidden = ['targetamount_encrypted', 'encrypted'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -86,7 +101,7 @@ class PiggyBank extends Model
|
|||||||
public function getNameAttribute($value)
|
public function getNameAttribute($value)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (intval($this->encrypted) == 1) {
|
if ($this->encrypted) {
|
||||||
return Crypt::decrypt($value);
|
return Crypt::decrypt($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,8 +159,8 @@ class PiggyBank extends Model
|
|||||||
*/
|
*/
|
||||||
public function setNameAttribute($value)
|
public function setNameAttribute($value)
|
||||||
{
|
{
|
||||||
$this->attributes['name'] = Crypt::encrypt($value);
|
$this->attributes['name'] = $value;
|
||||||
$this->attributes['encrypted'] = true;
|
$this->attributes['encrypted'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -23,6 +23,17 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
class PiggyBankEvent extends Model
|
class PiggyBankEvent extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'date' => 'date',
|
||||||
|
];
|
||||||
protected $dates = ['created_at', 'updated_at', 'date'];
|
protected $dates = ['created_at', 'updated_at', 'date'];
|
||||||
protected $fillable = ['piggy_bank_id', 'transaction_journal_id', 'date', 'amount'];
|
protected $fillable = ['piggy_bank_id', 'transaction_journal_id', 'date', 'amount'];
|
||||||
protected $hidden = ['amount_encrypted'];
|
protected $hidden = ['amount_encrypted'];
|
||||||
|
@@ -25,9 +25,21 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
class PiggyBankRepetition extends Model
|
class PiggyBankRepetition extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'deleted_at' => 'date',
|
||||||
|
'startdate' => 'date',
|
||||||
|
'targetdate' => 'date',
|
||||||
|
];
|
||||||
protected $dates = ['created_at', 'updated_at', 'startdate', 'targetdate'];
|
protected $dates = ['created_at', 'updated_at', 'startdate', 'targetdate'];
|
||||||
protected $fillable = ['piggy_bank_id', 'startdate', 'targetdate', 'currentamount'];
|
protected $fillable = ['piggy_bank_id', 'startdate', 'targetdate', 'currentamount'];
|
||||||
protected $hidden = ['currentamount_encrypted'];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||||
|
@@ -27,6 +27,16 @@ use Log;
|
|||||||
class Preference extends Model
|
class Preference extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
];
|
||||||
protected $dates = ['created_at', 'updated_at'];
|
protected $dates = ['created_at', 'updated_at'];
|
||||||
protected $fillable = ['user_id', 'data', 'name', 'data'];
|
protected $fillable = ['user_id', 'data', 'name', 'data'];
|
||||||
|
|
||||||
|
@@ -23,6 +23,17 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|||||||
*/
|
*/
|
||||||
class Role extends Model
|
class Role extends Model
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
];
|
||||||
|
protected $dates = ['created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||||
|
@@ -26,6 +26,23 @@ class Rule extends Model
|
|||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'deleted_at' => 'date',
|
||||||
|
'active' => 'boolean',
|
||||||
|
'order' => 'int',
|
||||||
|
'stop_processing' => 'boolean',
|
||||||
|
];
|
||||||
|
/** @var array */
|
||||||
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Rule $value
|
* @param Rule $value
|
||||||
*
|
*
|
||||||
|
@@ -22,6 +22,22 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
*/
|
*/
|
||||||
class RuleAction extends Model
|
class RuleAction extends Model
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'active' => 'boolean',
|
||||||
|
'order' => 'int',
|
||||||
|
'stop_processing' => 'boolean',
|
||||||
|
];
|
||||||
|
/** @var array */
|
||||||
|
protected $dates = ['created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||||
*/
|
*/
|
||||||
|
@@ -25,6 +25,22 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
class RuleGroup extends Model
|
class RuleGroup extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'deleted_at' => 'date',
|
||||||
|
'active' => 'boolean',
|
||||||
|
'order' => 'int',
|
||||||
|
];
|
||||||
|
/** @var array */
|
||||||
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||||
|
|
||||||
|
|
||||||
protected $fillable = ['user_id', 'order', 'title', 'description', 'active'];
|
protected $fillable = ['user_id', 'order', 'title', 'description', 'active'];
|
||||||
|
|
||||||
|
@@ -22,6 +22,22 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
*/
|
*/
|
||||||
class RuleTrigger extends Model
|
class RuleTrigger extends Model
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'active' => 'boolean',
|
||||||
|
'order' => 'int',
|
||||||
|
'stop_processing' => 'boolean',
|
||||||
|
];
|
||||||
|
/** @var array */
|
||||||
|
protected $dates = ['created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||||
*/
|
*/
|
||||||
|
@@ -15,6 +15,7 @@ namespace FireflyIII\Models;
|
|||||||
|
|
||||||
use Crypt;
|
use Crypt;
|
||||||
use FireflyIII\Support\Models\TagSupport;
|
use FireflyIII\Support\Models\TagSupport;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use Watson\Validating\ValidatingTrait;
|
use Watson\Validating\ValidatingTrait;
|
||||||
|
|
||||||
@@ -25,11 +26,25 @@ use Watson\Validating\ValidatingTrait;
|
|||||||
*/
|
*/
|
||||||
class Tag extends TagSupport
|
class Tag extends TagSupport
|
||||||
{
|
{
|
||||||
protected $dates = ['created_at', 'updated_at', 'date'];
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'deleted_at' => 'date',
|
||||||
|
'date' => 'date',
|
||||||
|
'zoomLevel' => 'int',
|
||||||
|
|
||||||
|
];
|
||||||
|
protected $dates = ['created_at', 'updated_at', 'date', 'deleted_at'];
|
||||||
protected $fillable = ['user_id', 'tag', 'date', 'description', 'longitude', 'latitude', 'zoomLevel', 'tagMode'];
|
protected $fillable = ['user_id', 'tag', 'date', 'description', 'longitude', 'latitude', 'zoomLevel', 'tagMode'];
|
||||||
protected $rules = ['tag' => 'required|between:1,200',];
|
protected $rules = ['tag' => 'required|between:1,200',];
|
||||||
|
|
||||||
use ValidatingTrait;
|
use ValidatingTrait, SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $fields
|
* @param array $fields
|
||||||
|
@@ -27,6 +27,18 @@ use Watson\Validating\ValidatingTrait;
|
|||||||
class Transaction extends Model
|
class Transaction extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'deleted_at' => 'date',
|
||||||
|
'identifier' => 'int',
|
||||||
|
];
|
||||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||||
protected $fillable = ['account_id', 'transaction_journal_id', 'description', 'amount', 'identifier'];
|
protected $fillable = ['account_id', 'transaction_journal_id', 'description', 'amount', 'identifier'];
|
||||||
protected $hidden = ['encrypted'];
|
protected $hidden = ['encrypted'];
|
||||||
@@ -37,7 +49,6 @@ class Transaction extends Model
|
|||||||
'description' => 'between:0,1024',
|
'description' => 'between:0,1024',
|
||||||
'amount' => 'required|numeric',
|
'amount' => 'required|numeric',
|
||||||
];
|
];
|
||||||
|
|
||||||
use SoftDeletes, ValidatingTrait;
|
use SoftDeletes, ValidatingTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -27,11 +27,20 @@ class TransactionCurrency extends Model
|
|||||||
{
|
{
|
||||||
use SoftDeletes, ValidatingTrait;
|
use SoftDeletes, ValidatingTrait;
|
||||||
|
|
||||||
|
protected $dates = ['created_at', 'updated_at', 'deleted_at','date'];
|
||||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
|
||||||
protected $fillable = ['name', 'code', 'symbol'];
|
protected $fillable = ['name', 'code', 'symbol'];
|
||||||
protected $rules = ['name' => 'required|between:1,200', 'code' => 'required|between:3,3', 'symbol' => 'required|between:1,12'];
|
protected $rules = ['name' => 'required|between:1,200', 'code' => 'required|between:3,3', 'symbol' => 'required|between:1,12'];
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'deleted_at' => 'date',
|
||||||
|
];
|
||||||
/**
|
/**
|
||||||
* @param TransactionCurrency $currency
|
* @param TransactionCurrency $currency
|
||||||
*
|
*
|
||||||
|
@@ -1,46 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* TransactionGroup.php
|
|
||||||
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types = 1);
|
|
||||||
|
|
||||||
namespace FireflyIII\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class TransactionGroup
|
|
||||||
*
|
|
||||||
* @package FireflyIII\Models
|
|
||||||
*/
|
|
||||||
class TransactionGroup extends Model
|
|
||||||
{
|
|
||||||
use SoftDeletes;
|
|
||||||
|
|
||||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
|
||||||
*/
|
|
||||||
public function transactionJournals()
|
|
||||||
{
|
|
||||||
return $this->belongsToMany('FireflyIII\Models\TransactionJournal');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
||||||
*/
|
|
||||||
public function user()
|
|
||||||
{
|
|
||||||
return $this->belongsTo('FireflyIII\User');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -34,6 +34,25 @@ class TransactionJournal extends TransactionJournalSupport
|
|||||||
{
|
{
|
||||||
use SoftDeletes, ValidatingTrait;
|
use SoftDeletes, ValidatingTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'deleted_at' => 'date',
|
||||||
|
'date' => 'date',
|
||||||
|
'interest_date' => 'date',
|
||||||
|
'book_date' => 'date',
|
||||||
|
'process_date' => 'date',
|
||||||
|
'order' => 'int',
|
||||||
|
'tag_count' => 'int',
|
||||||
|
'encrypted' => 'boolean',
|
||||||
|
'completed' => 'boolean',
|
||||||
|
];
|
||||||
/** @var array */
|
/** @var array */
|
||||||
protected $dates = ['created_at', 'updated_at', 'date', 'deleted_at', 'interest_date', 'book_date', 'process_date'];
|
protected $dates = ['created_at', 'updated_at', 'date', 'deleted_at', 'interest_date', 'book_date', 'process_date'];
|
||||||
/** @var array */
|
/** @var array */
|
||||||
@@ -352,8 +371,8 @@ class TransactionJournal extends TransactionJournalSupport
|
|||||||
*/
|
*/
|
||||||
public function setDescriptionAttribute($value)
|
public function setDescriptionAttribute($value)
|
||||||
{
|
{
|
||||||
$this->attributes['description'] = Crypt::encrypt($value);
|
$this->attributes['description'] = $value;
|
||||||
$this->attributes['encrypted'] = true;
|
$this->attributes['encrypted'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -26,7 +26,18 @@ class TransactionJournalMeta extends Model
|
|||||||
{
|
{
|
||||||
|
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
protected $dates = ['created_at', 'updated_at'];
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'deleted_at' => 'date',
|
||||||
|
];
|
||||||
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||||
protected $fillable = ['transaction_journal_id', 'name', 'data', 'hash'];
|
protected $fillable = ['transaction_journal_id', 'name', 'data', 'hash'];
|
||||||
protected $table = 'journal_meta';
|
protected $table = 'journal_meta';
|
||||||
|
|
||||||
|
@@ -31,6 +31,18 @@ class TransactionType extends Model
|
|||||||
const TRANSFER = 'Transfer';
|
const TRANSFER = 'Transfer';
|
||||||
const OPENING_BALANCE = 'Opening balance';
|
const OPENING_BALANCE = 'Opening balance';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'deleted_at' => 'date',
|
||||||
|
];
|
||||||
|
|
||||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -343,7 +343,9 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
$account->save();
|
$account->save();
|
||||||
|
|
||||||
$this->updateMetadata($account, $data);
|
$this->updateMetadata($account, $data);
|
||||||
|
if ($this->validOpeningBalanceData($data)) {
|
||||||
$this->updateInitialBalance($account, $data);
|
$this->updateInitialBalance($account, $data);
|
||||||
|
}
|
||||||
|
|
||||||
return $account;
|
return $account;
|
||||||
}
|
}
|
||||||
@@ -448,7 +450,6 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
'description' => 'Initial balance for "' . $account->name . '"',
|
'description' => 'Initial balance for "' . $account->name . '"',
|
||||||
'completed' => true,
|
'completed' => true,
|
||||||
'date' => $data['openingBalanceDate'],
|
'date' => $data['openingBalanceDate'],
|
||||||
'encrypted' => true,
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
Log::debug(sprintf('Created new opening balance journal: #%d', $journal->id));
|
Log::debug(sprintf('Created new opening balance journal: #%d', $journal->id));
|
||||||
|
Reference in New Issue
Block a user