mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Add payment terms to transformers (#3738)
This commit is contained in:
parent
970c9bb87d
commit
8129a5b49d
@ -265,6 +265,7 @@ class BaseController extends Controller
|
||||
'company.quotes.invitations.contact',
|
||||
'company.quotes.invitations.company',
|
||||
'company.credits',
|
||||
'company.payment_terms',
|
||||
//'company.credits.invitations.contact',
|
||||
//'company.credits.invitations.company',
|
||||
'company.vendors.contacts',
|
||||
@ -282,6 +283,7 @@ class BaseController extends Controller
|
||||
'company.users.company_user',
|
||||
'company.tax_rates',
|
||||
'company.groups',
|
||||
'company.payment_terms',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -284,6 +284,11 @@ class Company extends BaseModel
|
||||
return $this->hasMany(Design::class)->whereCompanyId($this->id)->orWhere('company_id', null);
|
||||
}
|
||||
|
||||
public function payment_terms()
|
||||
{
|
||||
return $this->hasMany(PaymentTerm::class)->whereCompanyId($this->id)->orWhere('company_id', null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
|
@ -23,6 +23,7 @@ use App\Models\Design;
|
||||
use App\Models\Expense;
|
||||
use App\Models\GroupSetting;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentTerm;
|
||||
use App\Models\Product;
|
||||
use App\Models\Project;
|
||||
use App\Models\Quote;
|
||||
@ -31,6 +32,7 @@ use App\Models\TaxRate;
|
||||
use App\Models\User;
|
||||
use App\Transformers\CompanyLedgerTransformer;
|
||||
use App\Transformers\CreditTransformer;
|
||||
use App\Transformers\PaymentTermTransformer;
|
||||
use App\Transformers\TaskTransformer;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
|
||||
@ -65,6 +67,7 @@ class CompanyTransformer extends EntityTransformer
|
||||
'expenses',
|
||||
'vendors',
|
||||
'payments',
|
||||
'payment_terms',
|
||||
'company_user',
|
||||
'groups',
|
||||
'company_gateways',
|
||||
@ -253,4 +256,11 @@ class CompanyTransformer extends EntityTransformer
|
||||
|
||||
return $this->includeCollection($company->ledger, $transformer, CompanyLedger::class);
|
||||
}
|
||||
|
||||
public function includePaymentTerms(Company $company)
|
||||
{
|
||||
$transformer = new PaymentTermTransformer($this->serializer);
|
||||
|
||||
return $this->includeCollection($company->payment_terms()->get(), $transformer, PaymentTerm::class);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user