Skip to content

Commit b9b5003

Browse files
committed
Refactor SettingController to validate categies by existing view files
1 parent a58102d commit b9b5003

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

app/Settings/SettingController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
class SettingController extends Controller
1111
{
12-
protected array $settingCategories = ['features', 'customization', 'registration'];
13-
1412
/**
1513
* Handle requests to the settings index path.
1614
*/
@@ -59,8 +57,8 @@ public function update(Request $request, AppSettingsStore $store, string $catego
5957

6058
protected function ensureCategoryExists(string $category): void
6159
{
62-
if (!in_array($category, $this->settingCategories)) {
63-
abort(404);
60+
if (!view()->exists('settings.' . $category)) {
61+
abort(404, 'Category not found');
6462
}
6563
}
6664
}

0 commit comments

Comments
 (0)