Merge branch 'recurring' of github.com:denisdulici/akaunting into recurring
This commit is contained in:
@ -107,9 +107,17 @@ class Invoices extends Controller
|
||||
|
||||
$categories = Category::enabled()->type('income')->pluck('name', 'id');
|
||||
|
||||
$recurrings = [
|
||||
'0' => trans('general.no'),
|
||||
'1' => trans('recurring.weekly'),
|
||||
'2' => trans('recurring.monthly'),
|
||||
'3' => trans('recurring.yearly'),
|
||||
'4' => trans('recurring.custom'),
|
||||
];
|
||||
|
||||
$number = $this->getNextInvoiceNumber();
|
||||
|
||||
return view('incomes.invoices.create', compact('customers', 'currencies', 'items', 'taxes', 'categories', 'number'));
|
||||
return view('incomes.invoices.create', compact('customers', 'currencies', 'items', 'taxes', 'categories', 'recurrings', 'number'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
17
app/Models/Common/Recurring.php
Normal file
17
app/Models/Common/Recurring.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Common;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class Recurring extends Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Get all of the owning recurrable models.
|
||||
*/
|
||||
public function recurrable()
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
}
|
@ -66,19 +66,14 @@ class Invoice extends Model
|
||||
return $this->belongsTo('App\Models\Setting\Category');
|
||||
}
|
||||
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Income\Customer');
|
||||
}
|
||||
|
||||
public function currency()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Setting\Currency', 'currency_code', 'code');
|
||||
}
|
||||
|
||||
public function status()
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Income\InvoiceStatus', 'invoice_status_code', 'code');
|
||||
return $this->belongsTo('App\Models\Income\Customer');
|
||||
}
|
||||
|
||||
public function items()
|
||||
@ -86,9 +81,9 @@ class Invoice extends Model
|
||||
return $this->hasMany('App\Models\Income\InvoiceItem');
|
||||
}
|
||||
|
||||
public function totals()
|
||||
public function histories()
|
||||
{
|
||||
return $this->hasMany('App\Models\Income\InvoiceTotal');
|
||||
return $this->hasMany('App\Models\Income\InvoiceHistory');
|
||||
}
|
||||
|
||||
public function payments()
|
||||
@ -96,9 +91,19 @@ class Invoice extends Model
|
||||
return $this->hasMany('App\Models\Income\InvoicePayment');
|
||||
}
|
||||
|
||||
public function histories()
|
||||
public function recurrings()
|
||||
{
|
||||
return $this->hasMany('App\Models\Income\InvoiceHistory');
|
||||
return $this->morphMany('App\Models\Common\Recurring', 'recurrable');
|
||||
}
|
||||
|
||||
public function status()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Income\InvoiceStatus', 'invoice_status_code', 'code');
|
||||
}
|
||||
|
||||
public function totals()
|
||||
{
|
||||
return $this->hasMany('App\Models\Income\InvoiceTotal');
|
||||
}
|
||||
|
||||
public function scopeDue($query, $date)
|
||||
|
Reference in New Issue
Block a user