Can now create recurring transactions. #1469

This commit is contained in:
James Cole
2018-06-17 15:14:34 +02:00
parent 54e3e3f051
commit d73cd4b515
25 changed files with 852 additions and 74 deletions

View File

@@ -65,14 +65,19 @@ class Recurrence extends Model
*/
protected $casts
= [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'first_date' => 'date',
'latest_date' => 'date',
'active' => 'bool',
'apply_rules' => 'bool',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
'title' => 'string',
'description' => 'string',
'first_date' => 'date',
'repeat_until' => 'date',
'latest_date' => 'date',
'repetitions' => 'int',
'active' => 'bool',
'apply_rules' => 'bool',
];
/** @var array */
/** @var array */
protected $fillable
= ['user_id', 'transaction_type_id', 'title', 'description', 'first_date', 'repeat_until', 'latest_date', 'repetitions', 'apply_rules', 'active'];
/** @var string */

View File

@@ -35,6 +35,18 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
*/
class RecurrenceMeta extends Model
{
/** @var array */
protected $casts
= [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
'name' => 'string',
'value' => 'string',
];
/** @var array */
protected $fillable = ['recurrence_id', 'name', 'value'];
/** @var string */
protected $table = 'recurrences_meta';
/**

View File

@@ -40,6 +40,18 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
*/
class RecurrenceRepetition extends Model
{
/** @var array */
protected $casts
= [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
'repetition_type' => 'string',
'repetition_moment' => 'string',
'repetition_skip' => 'int',
];
protected $fillable = ['recurrence_id', 'repetition_type', 'repetition_moment', 'repetition_skip'];
/** @var string */
protected $table = 'recurrences_repetitions';
/**

View File

@@ -48,6 +48,16 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
class RecurrenceTransaction extends Model
{
/** @var array */
protected $casts
= [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
'amount' => 'string',
'foreign_amount' => 'string',
'description' => 'string',
];
/** @var array */
protected $fillable
= ['recurrence_id', 'transaction_currency_id', 'foreign_currency_id', 'source_account_id', 'destination_account_id', 'amount', 'foreign_amount',
'description'];

View File

@@ -35,6 +35,17 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
*/
class RecurrenceTransactionMeta extends Model
{
/** @var array */
protected $casts
= [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
'name' => 'string',
'value' => 'string',
];
protected $fillable = ['rt_id', 'name', 'value'];
/** @var string */
protected $table = 'rt_meta';
/**
@@ -43,7 +54,7 @@ class RecurrenceTransactionMeta extends Model
*/
public function recurrenceTransaction(): BelongsTo
{
return $this->belongsTo(RecurrenceTransaction::class);
return $this->belongsTo(RecurrenceTransaction::class, 'rt_id');
}
}