Skip to content

Commit

Permalink
Fixed country show fields..
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Jun 1, 2023
1 parent 40b2944 commit b7fda70
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/Models/Common/Company.php
Expand Up @@ -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.
Expand Down Expand Up @@ -529,7 +529,7 @@ public function getLocationAttribute()

$country = setting('company.country');

if ($country && in_array($country, trans('countries'))) {
if ($country && array_key_exists($country, trans('countries'))) {
$location[] = trans('countries.' . $country);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Models/Common/Contact.php
Expand Up @@ -278,7 +278,7 @@ public function getLocationAttribute()
$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);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Models/Document/Document.php
Expand Up @@ -471,7 +471,7 @@ public function getContactLocationAttribute()
$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);
}

Expand Down
2 changes: 1 addition & 1 deletion app/View/Components/Index/Country.php
Expand Up @@ -37,7 +37,7 @@ public function __construct($code) {
*/
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);
}

Expand Down

0 comments on commit b7fda70

Please sign in to comment.