From b7fda70b98f77a20fbdc605b60cc31f8f5797ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Thu, 1 Jun 2023 16:42:11 +0300 Subject: [PATCH] Fixed country show fields.. --- app/Models/Common/Company.php | 4 ++-- app/Models/Common/Contact.php | 2 +- app/Models/Document/Document.php | 2 +- app/View/Components/Index/Country.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Models/Common/Company.php b/app/Models/Common/Company.php index a53d67ff0..4900db3da 100644 --- a/app/Models/Common/Company.php +++ b/app/Models/Common/Company.php @@ -27,7 +27,7 @@ class Company extends Eloquent implements Ownable protected $table = 'companies'; - protected $with = ['settings']; + //protected $with = ['settings']; /** * The accessors to append to the model's array form. @@ -529,7 +529,7 @@ class Company extends Eloquent implements Ownable $country = setting('company.country'); - if ($country && in_array($country, trans('countries'))) { + if ($country && array_key_exists($country, trans('countries'))) { $location[] = trans('countries.' . $country); } diff --git a/app/Models/Common/Contact.php b/app/Models/Common/Contact.php index f60e8517c..2583f750a 100644 --- a/app/Models/Common/Contact.php +++ b/app/Models/Common/Contact.php @@ -278,7 +278,7 @@ class Contact extends Model $location[] = $this->state; } - if ($this->country && in_array($this->country, trans('countries'))) { + if ($this->country && array_key_exists($this->country, trans('countries'))) { $location[] = trans('countries.' . $this->country); } diff --git a/app/Models/Document/Document.php b/app/Models/Document/Document.php index f57419b5a..323956a38 100644 --- a/app/Models/Document/Document.php +++ b/app/Models/Document/Document.php @@ -471,7 +471,7 @@ class Document extends Model $location[] = $this->contact_state; } - if ($this->contact_country && in_array($this->contact_country, trans('countries'))) { + if ($this->contact_country && array_key_exists($this->contact_country, trans('countries'))) { $location[] = trans('countries.' . $this->contact_country); } diff --git a/app/View/Components/Index/Country.php b/app/View/Components/Index/Country.php index 03ec0506c..14af10234 100644 --- a/app/View/Components/Index/Country.php +++ b/app/View/Components/Index/Country.php @@ -37,7 +37,7 @@ class Country extends Component */ public function render() { - if (! empty($this->code) && in_array($this->code, trans('countries'))) { + if (! empty($this->code) && array_key_exists($this->code, trans('countries'))) { $this->country = trans('countries.' . $this->code); }