Document and Transaction trait getSettingKey function replace get{Document/Transaction}SettingKey

This commit is contained in:
Cüneyt Şentürk
2023-04-12 14:58:35 +03:00
parent a084f83839
commit ee5822f062
8 changed files with 105 additions and 84 deletions

View File

@@ -29,6 +29,21 @@ trait Documents
return ! $this->isRecurring();
}
public function getRecurringDocumentTypes() : array
{
$types = array_keys(config('type.document'));
$recurring_types = [];
foreach ($types as $type) {
if (Str::endsWith($type, '-recurring')) {
$recurring_types[] = $type;
}
}
return $recurring_types;
}
public function getNextDocumentNumber(string $type): string
{
if ($alias = config('type.document.' . $type . '.alias')) {
@@ -138,7 +153,13 @@ trait Documents
return 'documents.statuses.';
}
// This function will be remoed in the future
protected function getSettingKey($type, $setting_key)
{
return $this->getDocumentSettingKey($type, $setting_key);
}
protected function getDocumentSettingKey($type, $setting_key)
{
$key = '';
$alias = config('type.document.' . $type . '.alias');

View File

@@ -132,7 +132,7 @@ trait Transactions
return Str::slug($transaction->id, $separator, language()->getShortCode());
}
protected function getSettingKey(string $type, string $setting_key): string
protected function getTransactionSettingKey(string $type, string $setting_key): string
{
$key = '';
$alias = config('type.transaction.' . $type . '.alias');