From 25b2d065724d1cc844d90aedf80a001e26c6d104 Mon Sep 17 00:00:00 2001 From: IceToast Date: Thu, 9 Feb 2023 20:40:24 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20Added=20Labels=20to=20setti?= =?UTF-8?q?ngs=20(controller)=20and=20show=20settings=20for=20category=20t?= =?UTF-8?q?ab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Admin/SettingsController.php | 15 +++- .../views/admin/settings/index.blade.php | 88 +++++++++++-------- 2 files changed, 67 insertions(+), 36 deletions(-) diff --git a/app/Http/Controllers/Admin/SettingsController.php b/app/Http/Controllers/Admin/SettingsController.php index f9ef3380..27d8bc74 100644 --- a/app/Http/Controllers/Admin/SettingsController.php +++ b/app/Http/Controllers/Admin/SettingsController.php @@ -27,8 +27,21 @@ class SettingsController extends Controller continue; } $className = 'App\\Settings\\' . str_replace('.php', '', $file); - $settings[str_replace('Settings.php', '', $file)] = (new $className())->toCollection()->all(); + $options = (new $className())->toArray(); + + + foreach ($options as $key => $value) { + $options[$key] = [ + 'value' => $value, + 'label' => ucwords(str_replace('_', ' ', $key)) + ]; + } + + + + $settings[str_replace('Settings.php', '', $file)] = $options; } + $settings->sort(); diff --git a/themes/default/views/admin/settings/index.blade.php b/themes/default/views/admin/settings/index.blade.php index 47589f35..ca4aefb1 100644 --- a/themes/default/views/admin/settings/index.blade.php +++ b/themes/default/views/admin/settings/index.blade.php @@ -39,31 +39,58 @@
- - - -
- - @foreach ($settings as $key => $value) - < - - @endforeach - +
@@ -76,21 +103,12 @@