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:
parent
a58102d6ef
commit
b9b5003239
@ -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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user