Code refactoring
This commit is contained in:
parent
c1604d4a3e
commit
aa7c82074c
@ -15,10 +15,14 @@ class Language extends Controller
|
|||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$locale = config('app.locale');
|
$locale = config('app.locale');
|
||||||
if (!$locale || !array_key_exists($locale, language()->allowed())) {
|
|
||||||
|
$lang_allowed = language()->allowed();
|
||||||
|
|
||||||
|
if (! $locale || ! array_key_exists($locale, $lang_allowed)) {
|
||||||
$locale = 'en-GB';
|
$locale = 'en-GB';
|
||||||
}
|
}
|
||||||
return view('install.language.create')->with(['locale' => $locale]);
|
|
||||||
|
return view('install.language.create', compact('locale', 'lang_allowed'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<x-slot name="content">
|
<x-slot name="content">
|
||||||
<div class="mb-0">
|
<div class="mb-0">
|
||||||
<select name="lang" id="lang" size="14" class="w-full text-black text-sm font-medium">
|
<select name="lang" id="lang" size="14" class="w-full text-black text-sm font-medium">
|
||||||
@foreach (language()->allowed() as $code => $name)
|
@foreach ($lang_allowed as $code => $name)
|
||||||
<option value="{{ $code }}" @if ($code == $locale) {{ 'selected="selected"' }} @endif>{{ $name }}</option>
|
<option value="{{ $code }}" @if ($code == $locale) {{ 'selected="selected"' }} @endif>{{ $name }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user