Use Searchable component for language setting
MODIFY
app/Http/Controllers/SettingsController.php
app/Http/Controllers/SettingsController.php
@@ -93,8 +93,12 @@ class SettingsController extends Controller {
}
public function getPreferences() {
- return view('settings.preferences', [
- 'languages' => config('app.locales')
- ]);
+ $languages = [];
+
+ foreach (config('app.locales') as $key => $value) {
+ $languages[] = ['key' => $key, 'label' => $value];
+ }
+
+ return view('settings.preferences', compact('languages'));
}
}

MODIFY
resources/views/settings/preferences.blade.php
resources/views/settings/preferences.blade.php
<div class="box__section">
<div class="input input--small">
<label>{{ __('fields.language') }}</label>
- <select name="language">
- @foreach ($languages as $key => $value)
- <option value="{{ $key }}" @if (Auth::user()->language === $key) selected @endif>{{ $value }}</option>
- @endforeach
- </select>
+ <searchable
+ name="language"
+ :items='@json($languages)'
+ initial="{{ Auth::user()->language }}"></searchable>
@include('partials.validation_error', ['payload' => 'language'])
</div>
<div class="input input--small">

Use Searchable component for language setting