first()->only('value'); $button_2 = Setting::where('key', 'Button2')->first()->only('value'); $button_3 = Setting::where('key', 'Button3')->first()->only('value'); return view('app.index', [ 'directories' => Directories::where('parent', \null)->where('id', '<>', 1)->orderBy('order', 'ASC')->get(), 'button_1' => \intval($button_1['value']), 'button_2' => \intval($button_2['value']), 'button_3' => \intval($button_3['value']) ]); } /** * Submit * * @param \App\Http\Requests\App\SubmitRequest $request * @return redirect */ public function submit(SubmitRequest $request) { Setting::where('key', 'Button1')->update(['value' => $request->button_1]); Setting::where('key', 'Button2')->update(['value' => $request->button_2]); Setting::where('key', 'Button3')->update(['value' => $request->button_3]); return redirect()->route('app.index')->with('status', __("Configuration sauvegardée.")); } }