This commit is contained in:
Kevin Adametz 2024-08-05 12:05:24 +02:00
parent 04d677d37a
commit bfa3bb1df4
1191 changed files with 637397 additions and 10619 deletions

View file

@ -90,6 +90,7 @@ class Homeparty extends Model
'settings' => 'array',
'order' => 'array',
'card_info' => 'array',
'trans_description' => 'array',
];
protected $dates = [
@ -106,7 +107,6 @@ class Homeparty extends Model
'name',
'place',
'country_id',
'description',
'pos',
'completed',
'status',
@ -152,6 +152,39 @@ class Homeparty extends Model
}
public function getLang($key, $default = true)
{
$lang = \App::getLocale();
if ($lang == 'de') {
return $this->{$key};
}
return $this->getTrans($key, $lang, $default);
}
public function getTrans($key, $lang, $default = true)
{
if ($lang == 'de') {
return $this->{$key};
}
if($key === 'description' && !empty($this->trans_description[$lang])){
return $this->trans_description[$lang];
}
if($default){
return !empty($this->{$key}) ? $this->{$key} : '';
}
return "";
}
public function getLangOrDefault($key, $default = true)
{
$dkey = 'default_'.$key;
$value = $this->getLang($key, $default);
if(!$value || $value == ""){
return __('homeparty.welcome_copy');
}
return $value;
}
public function getDateAttribute($value)
{
if (!$value) {