359 Select theme in settings (#423)

* Update composer package versions

* Laravel version

* Change theme in the admin settings page closes #359

* Fix comment
This commit is contained in:
Nabeel S
2019-10-30 09:05:18 -04:00
committed by GitHub
parent eff9f6fec6
commit ec4f10d43a
10 changed files with 391 additions and 339 deletions

View File

@@ -4,14 +4,34 @@ namespace App\Http\Controllers\Admin;
use App\Contracts\Controller;
use App\Models\Setting;
use Igaster\LaravelTheme\Facades\Theme;
use Illuminate\Http\Request;
use Log;
use Illuminate\Support\Facades\Log;
/**
* Class SettingsController
*/
class SettingsController extends Controller
{
/**
* Get a list of themes formatted for a select box
*
* @return array
*/
private function getThemes(): array
{
$themes = Theme::all();
$theme_list = [];
foreach ($themes as $t) {
if (!$t || !$t->name || $t->name === 'false') {
continue;
}
$theme_list[] = $t->name;
}
return $theme_list;
}
/**
* Display the settings. Group them by the setting group
*/
@@ -22,6 +42,7 @@ class SettingsController extends Controller
return view('admin.settings.index', [
'grouped_settings' => $settings,
'themes' => $this->getThemes(),
]);
}