public function info() { $info = ProviderPage::find(1); if (!$info) { abort(404); } return view('static.info', ['p' => 'info', 'text' => $info->text]); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(Request $request, $id) { try { $providerPage = ProviderPage::findOrFail($id); } catch (ModelNotFoundException $e) { abort(404); } $validationRules = ['text' => 'required']; $v = Validator::make($request->all(), $validationRules); if ($v->fails()) { return redirect()->back()->withErrors($v->errors())->withInput(); } $providerPage->text = $request->text; $providerPage->save(); return redirect('pageTexts')->with('alert-success', 'Текст на странице Для поставщиков изменен'); }