mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 20:21:10 -04:00
Merge branch 'helper-get-custom-field-bySlug' into 'master'
Helper for custom field to get by slug See merge request mohit.panjvani/crater-web!707
This commit is contained in:
@ -434,7 +434,7 @@ class Estimate extends Model implements HasMedia
|
|||||||
$estimateTemplate = EstimateTemplate::find($this->estimate_template_id);
|
$estimateTemplate = EstimateTemplate::find($this->estimate_template_id);
|
||||||
|
|
||||||
$company = Company::find($this->company_id);
|
$company = Company::find($this->company_id);
|
||||||
$locale = CompanySetting::getSetting('language', $company->id);
|
$locale = CompanySetting::getSetting('language', $company->id);
|
||||||
|
|
||||||
App::setLocale($locale);
|
App::setLocale($locale);
|
||||||
|
|
||||||
|
|||||||
@ -515,7 +515,7 @@ class Invoice extends Model implements HasMedia
|
|||||||
$invoiceTemplate = InvoiceTemplate::find($this->invoice_template_id);
|
$invoiceTemplate = InvoiceTemplate::find($this->invoice_template_id);
|
||||||
|
|
||||||
$company = Company::find($this->company_id);
|
$company = Company::find($this->company_id);
|
||||||
$locale = CompanySetting::getSetting('language', $company->id);
|
$locale = CompanySetting::getSetting('language', $company->id);
|
||||||
|
|
||||||
App::setLocale($locale);
|
App::setLocale($locale);
|
||||||
|
|
||||||
|
|||||||
@ -380,7 +380,7 @@ class Payment extends Model implements HasMedia
|
|||||||
public function getPDFData()
|
public function getPDFData()
|
||||||
{
|
{
|
||||||
$company = Company::find($this->company_id);
|
$company = Company::find($this->company_id);
|
||||||
$locale = CompanySetting::getSetting('language', $company->id);
|
$locale = CompanySetting::getSetting('language', $company->id);
|
||||||
|
|
||||||
\App::setLocale($locale);
|
\App::setLocale($locale);
|
||||||
|
|
||||||
|
|||||||
@ -42,4 +42,11 @@ trait HasCustomFieldsTrait
|
|||||||
$customFieldValue->save();
|
$customFieldValue->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCustomFieldBySlug($slug)
|
||||||
|
{
|
||||||
|
return $this->fields()->with('customField')->whereHas('customField', function ($query) use ($slug) {
|
||||||
|
$query->where('slug', $slug);
|
||||||
|
})->first();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user