20-02-2026
This commit is contained in:
parent
a8b395e20d
commit
a00c42e770
252 changed files with 28785 additions and 8907 deletions
|
|
@ -243,9 +243,43 @@ class ShoppingUser extends Model
|
|||
return $this->hasOne('App\Models\ShoppingOrder', 'shopping_user_id');
|
||||
}
|
||||
|
||||
public function getLocale()
|
||||
/**
|
||||
* Accessor für das language Attribut.
|
||||
* Gibt die App-Locale zurück, wenn keine Sprache gesetzt ist.
|
||||
*
|
||||
* @param string|null $value
|
||||
* @return string Sprachcode (de, en, es)
|
||||
*/
|
||||
public function getLanguageAttribute($value): string
|
||||
{
|
||||
return $this->language ? $this->language : \App::getLocale();
|
||||
return $value ?: \App::getLocale();
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias für getLanguageAttribute - für Konsistenz mit anderen Models.
|
||||
*
|
||||
* @return string Sprachcode (de, en, es)
|
||||
*/
|
||||
public function getLocale(): string
|
||||
{
|
||||
return $this->language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert die verfügbaren Sprachen aus der Config als Array für Select-Felder.
|
||||
*
|
||||
* @return array ['code' => 'Native Name', ...]
|
||||
*/
|
||||
public static function getAvailableLanguages(): array
|
||||
{
|
||||
$locales = config('localization.supportedLocales', []);
|
||||
$languages = [];
|
||||
|
||||
foreach ($locales as $code => $locale) {
|
||||
$languages[$code] = $locale['native'] ?? $locale['name'] ?? $code;
|
||||
}
|
||||
|
||||
return $languages;
|
||||
}
|
||||
|
||||
public function setNotice($key, $value)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue