Answer the question
In order to leave comments, you need to log in
How to validate a unique field in Larvel 5?
Hello! there is the following record update code
public function update(Request $request, $id)
{
$page = Page::findOrFail($id);
$this->validate($request, [
'title' => 'required',
'description' => 'required',
'slug' => 'required|unique:pages',
'status' => 'required',
'type' => 'required',
]);
$input = $request->all();
$page->fill($input)->save();
\Session::flash('page_updated', 'Страница обновлена!');
return redirect()->route('adminPages');
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question