From: Lachlan Tripolone Date: Thu, 10 Oct 2024 23:40:38 +0000 (+1100) Subject: Refactor SettingController to validate categies by existing view files X-Git-Tag: v24.10.1~1^2~11 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/b9b500323947f30ce8e7b2e19287ddefc27c4edb Refactor SettingController to validate categies by existing view files --- diff --git a/app/Settings/SettingController.php b/app/Settings/SettingController.php index bdbc3c78a..6ecc2bd1d 100644 --- a/app/Settings/SettingController.php +++ b/app/Settings/SettingController.php @@ -9,8 +9,6 @@ use Illuminate\Http\Request; class SettingController extends Controller { - protected array $settingCategories = ['features', 'customization', 'registration']; - /** * Handle requests to the settings index path. */ @@ -59,8 +57,8 @@ class SettingController extends Controller protected function ensureCategoryExists(string $category): void { - if (!in_array($category, $this->settingCategories)) { - abort(404); + if (!view()->exists('settings.' . $category)) { + abort(404, 'Category not found'); } } }