solve payment issue

This commit is contained in:
jayvirsinh_gohil
2022-01-11 15:06:07 +05:30
parent dcb3ddecb9
commit bcd80377cf
2 changed files with 9 additions and 5 deletions

View File

@ -442,7 +442,7 @@ class Payment extends Model implements HasMedia
$serial = (new SerialNumberFormatter())
->setModel(new Payment())
->setCompany(request()->header('company'))
->setCompany($invoice->company_id)
->setCustomer($invoice->customer_id)
->setNextNumbers();
@ -455,7 +455,7 @@ class Payment extends Model implements HasMedia
$data['exchange_rate'] = $invoice->exchange_rate;
$data['base_amount'] = $data['amount'] * $data['exchange_rate'];
$data['currency_id'] = $invoice->currency_id;
$data['company_id'] = request()->header('company');
$data['company_id'] = $invoice->company_id;
$data['transaction_id'] = $transaction->id;
$payment = Payment::create($data);

View File

@ -36,6 +36,11 @@ class PaymentMethod extends Model
return $this->belongsTo(Company::class);
}
public function scopeWhereCompanyId($query, $id)
{
$query->where('company_id', $id);
}
public function scopeWhereCompany($query)
{
$query->where('company_id', request()->header('company'));
@ -48,7 +53,7 @@ class PaymentMethod extends Model
public function scopeWhereSearch($query, $search)
{
$query->where('name', 'LIKE', '%' . $search . '%');
$query->where('name', 'LIKE', '%'.$search.'%');
}
public function scopeApplyFilters($query, array $filters)
@ -88,8 +93,7 @@ class PaymentMethod extends Model
public static function getSettings($id)
{
$settings = PaymentMethod::whereCompany()
->find($id)
$settings = PaymentMethod::find($id)
->settings;
return $settings;