address field detailed (city, zip_code, state, country)

This commit is contained in:
Cihan Şentürk
2021-09-03 11:43:55 +03:00
parent 04a4e869e3
commit ebeb8df1da
91 changed files with 15509 additions and 181 deletions

View File

@ -33,6 +33,10 @@ class Contact extends Model
'tax_number',
'phone',
'address',
'city',
'zip_code',
'state',
'country',
'website',
'currency_code',
'reference',
@ -188,6 +192,30 @@ class Contact extends Model
return $amount;
}
public function getLocationAttribute()
{
$location = [];
if ($this->city) {
$location[] = $this->city;
}
if ($this->zip_code) {
$location[] = $this->zip_code;
}
if ($this->state) {
$location[] = $this->state;
}
if ($this->country) {
$location[] = trans('countries.' . $this->country);
}
return implode(', ', $location);
}
/**
* Create a new factory instance for the model.
*