namespace BookStack\Settings;
use BookStack\Activity\ActivityType;
+use BookStack\App\AppVersion;
use BookStack\Http\Controller;
+use BookStack\Permissions\Permission;
use BookStack\Users\Models\User;
use Illuminate\Http\Request;
public function category(string $category)
{
$this->ensureCategoryExists($category);
- $this->checkPermission('settings-manage');
+ $this->checkPermission(Permission::SettingsManage);
$this->setPageTitle(trans('settings.settings'));
- // Get application version
- $version = trim(file_get_contents(base_path('version')));
-
- return view('settings.' . $category, [
+ return view('settings.categories.' . $category, [
'category' => $category,
- 'version' => $version,
+ 'version' => AppVersion::get(),
'guestUser' => User::getGuest(),
]);
}
{
$this->ensureCategoryExists($category);
$this->preventAccessInDemoMode();
- $this->checkPermission('settings-manage');
+ $this->checkPermission(Permission::SettingsManage);
$this->validate($request, [
'app_logo' => ['nullable', ...$this->getImageValidationRules()],
'app_icon' => ['nullable', ...$this->getImageValidationRules()],
protected function ensureCategoryExists(string $category): void
{
- if (!view()->exists('settings.' . $category)) {
- abort(404, 'Category not found');
+ if (!view()->exists('settings.categories.' . $category)) {
+ abort(404);
}
}
}