mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-22 10:52:30 +01:00
Refactor SettingController to validate categies by existing view files
This commit is contained in:
parent
a58102d6ef
commit
b9b5003239
@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user