Add ability to change theme in settings
MODIFY
app/Http/Controllers/SettingsController.php
app/Http/Controllers/SettingsController.php
@@ -22,7 +22,8 @@ class SettingsController extends Controller {
$request->validate([
'avatar' => 'nullable|mimes:jpeg,jpg,png,gif',
'password' => 'nullable|confirmed',
- 'language' => 'required|in:' . implode(',', array_keys(config('app.locales')))
+ 'language' => 'required|in:' . implode(',', array_keys(config('app.locales'))),
+ 'theme' => 'required|in:light,dark'
]);
$user = Auth::user();
@@ -48,6 +49,7 @@ class SettingsController extends Controller {
}
$user->language = $request->input('language');
+ $user->theme = $request->input('theme');
$user->save();

MODIFY
resources/views/settings.blade.php
resources/views/settings.blade.php
<div class="box__section row">
<div class="row__column">Preferences</div>
<div class="row__column" style="flex: 2;">
- <div class="input input--small mb-0">
+ <div class="input input--small">
<label>{{ __('general.language') }}</label>
<select name="language">
@foreach ($languages as $key => $value)
</select>
@include('partials.validation_error', ['payload' => 'language'])
</div>
+ <div class="input input--small mb-0">
+ <label>{{ __('general.theme') }}</label>
+ <select name="theme">
+ <option value="light" {{ Auth::user()->theme == 'light' ? 'selected' : '' }}>Light</option>
+ <option value="dark" {{ Auth::user()->theme == 'dark' ? 'selected' : '' }}>Dark (Experimental)</option>
+ </select>
+ @include('partials.validation_error', ['payload' => 'theme'])
+ </div>
</div>
</div>
<div class="box__section box__section--highlight text-right">

Add ability to change theme in settings