Compare commits

...

3 Commits

2 changed files with 2 additions and 12 deletions

View File

@ -31,7 +31,6 @@ if (!function_exists('webmail_host')) {
if (!function_exists('mta_host')) {
function mta_host(?int $domainId = null): string
{
// 1⃣ Vorrang: Datenbankwert (z. B. aus der domains-Tabelle)
if ($domainId) {
try {
$domain = \App\Models\Domain::find($domainId);
@ -39,29 +38,22 @@ if (!function_exists('mta_host')) {
return $domain->mta_host;
}
} catch (\Throwable $e) {
// DB evtl. noch nicht migriert — fallback auf env
// DB evtl. noch nicht migriert — fallback auf env
}
}
// 2⃣ ENV-Variante (z. B. MTA_SUB=mail01)
$sub = env('MTA_SUB');
if ($sub) {
return domain_host($sub);
}
// 3⃣ Notfall: statischer Fallback
return domain_host('mx');
}
}
if (! function_exists('countryFlag')) {
/**
* Gibt das Flag-Emoji eines Landes zurück anhand des ISO-Codes (z. B. "de" 🇩🇪).
*/
function countryFlag(string $code): string
{
$code = strtoupper($code);
// Unicode-Magic: A -> 🇦, B -> 🇧 etc.
return implode('', array_map(
fn($char) => mb_chr(ord($char) + 127397, 'UTF-8'),
str_split($code)

View File

@ -5,9 +5,7 @@
<select wire:model.defer="locale"
class="w-full h-11 rounded-xl border border-white/10 bg-white/[0.04] px-3 text-white/90">
@foreach (config('mailwolt.language') as $key => $lang)
<option value="{{ $lang['locale'] }}">
{{ countryFlag($lang['flag']) }} {{ $lang['label'] }}
</option>
<option value="{{ $lang['locale'] }}">{{ $lang['label'] }}</option>
@endforeach
</select>
@error('locale') <p class="text-xs text-rose-400 mt-1">{{ $message }}</p> @enderror