1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-11-26 04:42:37 +01:00

Refactor SettingController to validate categies by existing view files

This commit is contained in:
Lachlan Tripolone 2024-10-11 10:40:38 +11:00
parent a58102d6ef
commit b9b5003239

View File

@ -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');
}
}
}