1 <?php namespace BookStack\Http\Controllers;
3 use Illuminate\Http\Request;
5 use BookStack\Http\Requests;
8 class SettingController extends Controller
11 * Display a listing of the settings.
14 public function index()
16 $this->checkPermission('settings-manage');
17 $this->setPageTitle('Settings');
19 // Get application version
21 if (function_exists('exec')) {
22 $version = exec('git describe --always --tags ');
25 return view('settings/index', ['version' => $version]);
29 * Update the specified settings in storage.
30 * @param Request $request
33 public function update(Request $request)
35 $this->preventAccessForDemoUsers();
36 $this->checkPermission('settings-manage');
38 // Cycles through posted settings and update them
39 foreach ($request->all() as $name => $value) {
40 if (strpos($name, 'setting-') !== 0) continue;
41 $key = str_replace('setting-', '', trim($name));
42 Setting::put($key, $value);
45 session()->flash('success', 'Settings Saved');
46 return redirect('/settings');