From 2455ec5d7e14ebcc3f9eb4f7719a65598aac7b25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Sat, 9 Jan 2021 23:41:01 +0300 Subject: [PATCH] some changes.. --- app/Abstracts/View/Components/Document.php | 4 ++-- app/Http/Requests/Document/Document.php | 2 +- app/Listeners/Document/MarkDocumentCancelled.php | 14 +++++++++----- app/Listeners/Document/MarkDocumentReceived.php | 14 +++++++++----- app/Listeners/Document/MarkDocumentSent.php | 14 +++++++++----- app/Listeners/Document/MarkDocumentViewed.php | 14 +++++++++----- app/View/Components/Documents/Form/Company.php | 2 +- 7 files changed, 40 insertions(+), 24 deletions(-) diff --git a/app/Abstracts/View/Components/Document.php b/app/Abstracts/View/Components/Document.php index c8a129019..45b66886f 100644 --- a/app/Abstracts/View/Components/Document.php +++ b/app/Abstracts/View/Components/Document.php @@ -17,7 +17,7 @@ abstract class Document extends Component } $alias = config('type.' . $type . '.alias'); - $prefix = config("type.' . $type . '.translation.prefix"); + $prefix = config('type.' . $type . '.translation.prefix'); if (!empty($alias)) { $alias .= '::'; @@ -92,7 +92,7 @@ abstract class Document extends Component $alias = config('type.' . $type . '.alias'); $group = config('type.' . $type . '.group'); - $prefix = config("type.' . $type . '.permission.prefix"); + $prefix = config('type.' . $type . '.permission.prefix'); $permission = $config_key . '-'; diff --git a/app/Http/Requests/Document/Document.php b/app/Http/Requests/Document/Document.php index 01d20745f..80fd4ff71 100644 --- a/app/Http/Requests/Document/Document.php +++ b/app/Http/Requests/Document/Document.php @@ -28,7 +28,7 @@ class Document extends FormRequest { $type = $this->request->get('type', Model::INVOICE_TYPE); - $type = config("type.{$type}.route_parameter"); + $type = config('type.' . $type . '.route_parameter'); // Check if store or update if ($this->getMethod() == 'PATCH') { diff --git a/app/Listeners/Document/MarkDocumentCancelled.php b/app/Listeners/Document/MarkDocumentCancelled.php index 5a7c7df0b..cbb52e2f7 100644 --- a/app/Listeners/Document/MarkDocumentCancelled.php +++ b/app/Listeners/Document/MarkDocumentCancelled.php @@ -21,11 +21,15 @@ class MarkDocumentCancelled { $this->dispatch(new CancelDocument($event->document)); - $type = trans_choice( - config("type.{$event->document->type}.alias", '') . - 'general.' . config("type.{$event->document->type}.translation_key"), - 1 - ); + $type_text = ''; + + if ($alias = config('type.' . $event->document->type . '.alias', '')) { + $type_text .= $alias . '::'; + } + + $type_text .= 'general.' . config('type.' . $event->document->type .'.translation.prefix'); + + $type = trans_choice($type_text, 1); $this->dispatch( new CreateDocumentHistory( diff --git a/app/Listeners/Document/MarkDocumentReceived.php b/app/Listeners/Document/MarkDocumentReceived.php index bae62d368..db6696d0a 100644 --- a/app/Listeners/Document/MarkDocumentReceived.php +++ b/app/Listeners/Document/MarkDocumentReceived.php @@ -24,11 +24,15 @@ class MarkDocumentReceived $event->document->save(); } - $type = trans_choice( - config("type.{$event->document->type}.alias", '') . - 'general.' . config("type.{$event->document->type}.translation_key"), - 1 - ); + $type_text = ''; + + if ($alias = config('type.' . $event->document->type . '.alias', '')) { + $type_text .= $alias . '::'; + } + + $type_text .= 'general.' . config('type.' . $event->document->type .'.translation.prefix'); + + $type = trans_choice($type_text, 1); $this->dispatch( new CreateDocumentHistory( diff --git a/app/Listeners/Document/MarkDocumentSent.php b/app/Listeners/Document/MarkDocumentSent.php index 8f88e7842..db68140c0 100644 --- a/app/Listeners/Document/MarkDocumentSent.php +++ b/app/Listeners/Document/MarkDocumentSent.php @@ -24,11 +24,15 @@ class MarkDocumentSent $event->document->save(); } - $type = trans_choice( - config("type.{$event->document->type}.alias", '') . - 'general.' . config("type.{$event->document->type}.translation_key"), - 1 - ); + $type_text = ''; + + if ($alias = config('type.' . $event->document->type . '.alias', '')) { + $type_text .= $alias . '::'; + } + + $type_text .= 'general.' . config('type.' . $event->document->type .'.translation.prefix'); + + $type = trans_choice($type_text, 1); $this->dispatch( new CreateDocumentHistory( diff --git a/app/Listeners/Document/MarkDocumentViewed.php b/app/Listeners/Document/MarkDocumentViewed.php index 7a447e518..cd862eaa8 100644 --- a/app/Listeners/Document/MarkDocumentViewed.php +++ b/app/Listeners/Document/MarkDocumentViewed.php @@ -29,11 +29,15 @@ class MarkDocumentViewed $document->status = 'viewed'; $document->save(); - $type = trans_choice( - config("type.{$event->document->type}.alias", '') . - 'general.' . config("type.{$event->document->type}.translation_key"), - 1 - ); + $type_text = ''; + + if ($alias = config('type.' . $event->document->type . '.alias', '')) { + $type_text .= $alias . '::'; + } + + $type_text .= 'general.' . config('type.' . $event->document->type .'.translation.prefix'); + + $type = trans_choice($type_text, 1); $this->dispatch( new CreateDocumentHistory( diff --git a/app/View/Components/Documents/Form/Company.php b/app/View/Components/Documents/Form/Company.php index 329379c7d..7931216b1 100644 --- a/app/View/Components/Documents/Form/Company.php +++ b/app/View/Components/Documents/Form/Company.php @@ -16,7 +16,7 @@ class Company extends Component { $company = user()->companies()->first(); - $inputNameType = config("type.{$this->type}.route_parameter"); + $inputNameType = config('type.' . $this->type . '.route.parameter'); return view('components.documents.form.company', compact('company','inputNameType')); }