form stuff done

This commit is contained in:
denisdulici
2018-04-26 18:40:04 +03:00
parent 1e4d4cf581
commit b5e937b58d
23 changed files with 347 additions and 58 deletions

View File

@ -58,26 +58,21 @@ class Bill extends Model
*
* @var array
*/
protected $cloneable_relations = ['items', 'totals'];
protected $cloneable_relations = ['items', 'recurring', 'totals'];
public function category()
{
return $this->belongsTo('App\Models\Setting\Category');
}
public function vendor()
{
return $this->belongsTo('App\Models\Expense\Vendor');
}
public function currency()
{
return $this->belongsTo('App\Models\Setting\Currency', 'currency_code', 'code');
}
public function status()
public function histories()
{
return $this->belongsTo('App\Models\Expense\BillStatus', 'bill_status_code', 'code');
return $this->hasMany('App\Models\Expense\BillHistory');
}
public function items()
@ -85,19 +80,29 @@ class Bill extends Model
return $this->hasMany('App\Models\Expense\BillItem');
}
public function totals()
{
return $this->hasMany('App\Models\Expense\BillTotal');
}
public function payments()
{
return $this->hasMany('App\Models\Expense\BillPayment');
}
public function histories()
public function recurring()
{
return $this->hasMany('App\Models\Expense\BillHistory');
return $this->morphOne('App\Models\Common\Recurring', 'recurrable');
}
public function status()
{
return $this->belongsTo('App\Models\Expense\BillStatus', 'bill_status_code', 'code');
}
public function totals()
{
return $this->hasMany('App\Models\Expense\BillTotal');
}
public function vendor()
{
return $this->belongsTo('App\Models\Expense\Vendor');
}
public function scopeDue($query, $date)

View File

@ -44,24 +44,31 @@ class Payment extends Model
'description' ,
];
/**
* Clonable relationships.
*
* @var array
*/
protected $cloneable_relations = ['recurring'];
public function account()
{
return $this->belongsTo('App\Models\Banking\Account');
}
public function currency()
{
return $this->belongsTo('App\Models\Setting\Currency', 'currency_code', 'code');
}
public function category()
{
return $this->belongsTo('App\Models\Setting\Category');
}
public function vendor()
public function currency()
{
return $this->belongsTo('App\Models\Expense\Vendor');
return $this->belongsTo('App\Models\Setting\Currency', 'currency_code', 'code');
}
public function recurring()
{
return $this->morphOne('App\Models\Common\Recurring', 'recurrable');
}
public function transfers()
@ -69,6 +76,11 @@ class Payment extends Model
return $this->hasMany('App\Models\Banking\Transfer');
}
public function vendor()
{
return $this->belongsTo('App\Models\Expense\Vendor');
}
/**
* Get only transfers.
*