1 <?php namespace BookStack\Http\Controllers;
3 use Illuminate\Http\Request;
4 use Illuminate\Http\Response;
7 class SettingController extends Controller
10 * Display a listing of the settings.
13 public function index()
15 $this->checkPermission('settings-manage');
16 $this->setPageTitle('Settings');
18 // Get application version
19 $version = trim(file_get_contents(base_path('version')));
21 return view('settings/index', ['version' => $version]);
25 * Update the specified settings in storage.
26 * @param Request $request
29 public function update(Request $request)
31 $this->preventAccessForDemoUsers();
32 $this->checkPermission('settings-manage');
34 // Cycles through posted settings and update them
35 foreach ($request->all() as $name => $value) {
36 if (strpos($name, 'setting-') !== 0) continue;
37 $key = str_replace('setting-', '', trim($name));
38 Setting::put($key, $value);
41 session()->flash('success', trans('settings.settings_save_success'));
42 return redirect('/settings');