Compare commits
3 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
af369acbf6 | |
|
|
d81c3bc07c | |
|
|
821a2bde33 |
|
|
@ -31,7 +31,6 @@ if (!function_exists('webmail_host')) {
|
||||||
if (!function_exists('mta_host')) {
|
if (!function_exists('mta_host')) {
|
||||||
function mta_host(?int $domainId = null): string
|
function mta_host(?int $domainId = null): string
|
||||||
{
|
{
|
||||||
// 1️⃣ Vorrang: Datenbankwert (z. B. aus der domains-Tabelle)
|
|
||||||
if ($domainId) {
|
if ($domainId) {
|
||||||
try {
|
try {
|
||||||
$domain = \App\Models\Domain::find($domainId);
|
$domain = \App\Models\Domain::find($domainId);
|
||||||
|
|
@ -39,29 +38,22 @@ if (!function_exists('mta_host')) {
|
||||||
return $domain->mta_host;
|
return $domain->mta_host;
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} 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');
|
$sub = env('MTA_SUB');
|
||||||
if ($sub) {
|
if ($sub) {
|
||||||
return domain_host($sub);
|
return domain_host($sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3️⃣ Notfall: statischer Fallback
|
|
||||||
return domain_host('mx');
|
return domain_host('mx');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! function_exists('countryFlag')) {
|
if (! function_exists('countryFlag')) {
|
||||||
/**
|
|
||||||
* Gibt das Flag-Emoji eines Landes zurück anhand des ISO-Codes (z. B. "de" → 🇩🇪).
|
|
||||||
*/
|
|
||||||
function countryFlag(string $code): string
|
function countryFlag(string $code): string
|
||||||
{
|
{
|
||||||
$code = strtoupper($code);
|
$code = strtoupper($code);
|
||||||
// Unicode-Magic: A -> 🇦, B -> 🇧 etc.
|
|
||||||
return implode('', array_map(
|
return implode('', array_map(
|
||||||
fn($char) => mb_chr(ord($char) + 127397, 'UTF-8'),
|
fn($char) => mb_chr(ord($char) + 127397, 'UTF-8'),
|
||||||
str_split($code)
|
str_split($code)
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,7 @@
|
||||||
<select wire:model.defer="locale"
|
<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">
|
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)
|
@foreach (config('mailwolt.language') as $key => $lang)
|
||||||
<option value="{{ $lang['locale'] }}">
|
<option value="{{ $lang['locale'] }}">{{ $lang['label'] }}</option>
|
||||||
{{ countryFlag($lang['flag']) }} {{ $lang['label'] }}
|
|
||||||
</option>
|
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
@error('locale') <p class="text-xs text-rose-400 mt-1">{{ $message }}</p> @enderror
|
@error('locale') <p class="text-xs text-rose-400 mt-1">{{ $message }}</p> @enderror
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue