close #2880 Enhancement: Username changed, but not reflecting on list of recurring invoice
This commit is contained in:
@ -6,6 +6,7 @@ use App\Traits\Media;
|
||||
use App\Abstracts\Model;
|
||||
use App\Traits\Contacts;
|
||||
use App\Traits\Currencies;
|
||||
use App\Traits\Documents;
|
||||
use App\Traits\Transactions;
|
||||
use App\Scopes\Contact as Scope;
|
||||
use App\Models\Document\Document;
|
||||
@ -17,7 +18,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Contact extends Model
|
||||
{
|
||||
use Cloneable, Contacts, Currencies, HasFactory, Media, Notifiable, Transactions;
|
||||
use Cloneable, Contacts, Currencies, Documents, HasFactory, Media, Notifiable, Transactions;
|
||||
|
||||
public const CUSTOMER_TYPE = 'customer';
|
||||
public const VENDOR_TYPE = 'vendor';
|
||||
@ -82,11 +83,31 @@ class Contact extends Model
|
||||
return $this->hasMany('App\Models\Document\Document');
|
||||
}
|
||||
|
||||
public function document_recurring()
|
||||
{
|
||||
return $this->documents()->whereIn('documents.type', $this->getRecurringDocumentTypes());
|
||||
}
|
||||
|
||||
public function bills()
|
||||
{
|
||||
return $this->documents()->where('documents.type', Document::BILL_TYPE);
|
||||
}
|
||||
|
||||
public function bill_recurring()
|
||||
{
|
||||
return $this->documents()->where('documents.type', Document::BILL_RECURRING_TYPE);
|
||||
}
|
||||
|
||||
public function invoices()
|
||||
{
|
||||
return $this->documents()->where('documents.type', Document::INVOICE_TYPE);
|
||||
}
|
||||
|
||||
public function invoice_recurring()
|
||||
{
|
||||
return $this->documents()->where('documents.type', Document::INVOICE_RECURRING_TYPE);
|
||||
}
|
||||
|
||||
public function currency()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Setting\Currency', 'currency_code', 'code');
|
||||
@ -102,11 +123,6 @@ class Contact extends Model
|
||||
return $this->transactions()->whereIn('transactions.type', (array) $this->getIncomeTypes());
|
||||
}
|
||||
|
||||
public function invoices()
|
||||
{
|
||||
return $this->documents()->where('documents.type', Document::INVOICE_TYPE);
|
||||
}
|
||||
|
||||
public function transactions()
|
||||
{
|
||||
return $this->hasMany('App\Models\Banking\Transaction');
|
||||
|
Reference in New Issue
Block a user