Merge pull request #2327 from burakcakirel/setting-key
Get dynamic setting key for apps
This commit is contained in:
commit
a3c6fc8f64
@ -1187,8 +1187,10 @@ abstract class DocumentShow extends Base
|
|||||||
return $textDocumentTitle;
|
return $textDocumentTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty(setting($type . '.title'))) {
|
$key = $this->getSettingKey($type, 'title');
|
||||||
return setting($type . '.title');
|
|
||||||
|
if (!empty(setting($key))) {
|
||||||
|
return setting($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
$translation = $this->getTextFromConfig($type, 'document_title', Str::plural($type), 'trans_choice');
|
$translation = $this->getTextFromConfig($type, 'document_title', Str::plural($type), 'trans_choice');
|
||||||
@ -1206,8 +1208,10 @@ abstract class DocumentShow extends Base
|
|||||||
return $textDocumentSubheading;
|
return $textDocumentSubheading;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty(setting($type . '.subheading'))) {
|
$key = $this->getSettingKey($type, 'subheading');
|
||||||
return setting($type . '.subheading');
|
|
||||||
|
if (!empty(setting($key))) {
|
||||||
|
return setting($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
$translation = $this->getTextFromConfig($type, 'document_subheading', 'subheading');
|
$translation = $this->getTextFromConfig($type, 'document_subheading', 'subheading');
|
||||||
|
@ -272,8 +272,10 @@ abstract class DocumentTemplate extends Base
|
|||||||
return $textDocumentTitle;
|
return $textDocumentTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty(setting($type . '.title'))) {
|
$key = $this->getSettingKey($type, 'title');
|
||||||
return setting($type . '.title');
|
|
||||||
|
if (!empty(setting($key))) {
|
||||||
|
return setting($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
$translation = $this->getTextFromConfig($type, 'document_title', Str::plural($type));
|
$translation = $this->getTextFromConfig($type, 'document_title', Str::plural($type));
|
||||||
@ -291,8 +293,10 @@ abstract class DocumentTemplate extends Base
|
|||||||
return $textDocumentSubheading;
|
return $textDocumentSubheading;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty(setting($type . '.subheading'))) {
|
$key = $this->getSettingKey($type, 'subheading');
|
||||||
return setting($type . '.subheading');
|
|
||||||
|
if (!empty(setting($key))) {
|
||||||
|
return setting($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
$translation = $this->getTextFromConfig($type, 'document_subheading', 'subheading');
|
$translation = $this->getTextFromConfig($type, 'document_subheading', 'subheading');
|
||||||
@ -427,7 +431,7 @@ abstract class DocumentTemplate extends Base
|
|||||||
return $textItems;
|
return $textItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setting($this->getSettingKey($type, 'item_name')) !== null &&
|
if (setting($this->getSettingKey($type, 'item_name')) !== null &&
|
||||||
(trans(setting($this->getSettingKey($type, 'item_name'))) != setting($this->getSettingKey($type, 'item_name')))
|
(trans(setting($this->getSettingKey($type, 'item_name'))) != setting($this->getSettingKey($type, 'item_name')))
|
||||||
) {
|
) {
|
||||||
return setting($this->getSettingKey($type, 'item_name'));
|
return setting($this->getSettingKey($type, 'item_name'));
|
||||||
@ -457,7 +461,7 @@ abstract class DocumentTemplate extends Base
|
|||||||
return $textQuantity;
|
return $textQuantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setting($this->getSettingKey($type, 'quantity_name')) !== null &&
|
if (setting($this->getSettingKey($type, 'quantity_name')) !== null &&
|
||||||
(trans(setting($this->getSettingKey($type, 'quantity_name'))) != setting($this->getSettingKey($type, 'quantity_name')))
|
(trans(setting($this->getSettingKey($type, 'quantity_name'))) != setting($this->getSettingKey($type, 'quantity_name')))
|
||||||
) {
|
) {
|
||||||
return setting($this->getSettingKey($type, 'quantity_name'));
|
return setting($this->getSettingKey($type, 'quantity_name'));
|
||||||
@ -487,7 +491,7 @@ abstract class DocumentTemplate extends Base
|
|||||||
return $textPrice;
|
return $textPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setting($this->getSettingKey($type, 'price_name')) !== null &&
|
if (setting($this->getSettingKey($type, 'price_name')) !== null &&
|
||||||
(trans(setting($this->getSettingKey($type, 'price_name'))) != setting($this->getSettingKey($type, 'price_name')))
|
(trans(setting($this->getSettingKey($type, 'price_name'))) != setting($this->getSettingKey($type, 'price_name')))
|
||||||
) {
|
) {
|
||||||
return setting($this->getSettingKey($type, 'price_name'));
|
return setting($this->getSettingKey($type, 'price_name'));
|
||||||
|
@ -42,7 +42,7 @@ class SettingFieldCreated
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$real_key = $type . '.' . $key;
|
$real_key = $this->getSettingKey($type, $key);
|
||||||
|
|
||||||
setting()->set($real_key, $value);
|
setting()->set($real_key, $value);
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ class SettingFieldCreated
|
|||||||
$company = Company::find($document->company_id);
|
$company = Company::find($document->company_id);
|
||||||
|
|
||||||
foreach ($files as $key => $value) {
|
foreach ($files as $key => $value) {
|
||||||
// Upload attachment
|
// Upload attachment
|
||||||
$media = $this->getMedia($value, 'settings');
|
$media = $this->getMedia($value, 'settings');
|
||||||
|
|
||||||
$company->attachMedia($media, Str::snake($real_key));
|
$company->attachMedia($media, Str::snake($real_key));
|
||||||
@ -66,7 +66,7 @@ class SettingFieldCreated
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$real_key = $type . '.' . $key;
|
$real_key = setting($this->getSettingKey($type, $key));
|
||||||
|
|
||||||
setting()->set($real_key, $value);
|
setting()->set($real_key, $value);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user