mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-08-07 23:03:00 +03:00
Refactor SettingController to validate categies by existing view files
This commit is contained in:
@@ -9,8 +9,6 @@ use Illuminate\Http\Request;
|
|||||||
|
|
||||||
class SettingController extends Controller
|
class SettingController extends Controller
|
||||||
{
|
{
|
||||||
protected array $settingCategories = ['features', 'customization', 'registration'];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle requests to the settings index path.
|
* Handle requests to the settings index path.
|
||||||
*/
|
*/
|
||||||
@@ -59,8 +57,8 @@ class SettingController extends Controller
|
|||||||
|
|
||||||
protected function ensureCategoryExists(string $category): void
|
protected function ensureCategoryExists(string $category): void
|
||||||
{
|
{
|
||||||
if (!in_array($category, $this->settingCategories)) {
|
if (!view()->exists('settings.' . $category)) {
|
||||||
abort(404);
|
abort(404, 'Category not found');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user