Code refactoring

This commit is contained in:
EnesSacid-Buker 2023-02-15 23:08:28 +03:00 committed by GitHub
parent c1604d4a3e
commit aa7c82074c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -15,10 +15,14 @@ class Language extends Controller
public function create()
{
$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';
}
return view('install.language.create')->with(['locale' => $locale]);
return view('install.language.create', compact('locale', 'lang_allowed'));
}
/**

View File

@ -6,7 +6,7 @@
<x-slot name="content">
<div class="mb-0">
<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>
@endforeach
</select>