제출 버튼을 클릭하면 MethodNotAllowedHttpException 줄이 생깁니다. 218 행이 내 경로 인 것처럼 보입니다.laravel 5.2에서 테이블을 업데이트하는 방법 012
내 블레이드 is`id ")}}"METHOD = "POST">
{{csrf_field()}} {{method_field은 (}}) "PUT는 '
<table>
<tr>
<td>Name</td>
<td>
<input type = 'text' name = 'name' value = '{{ $users->name}}'/>
</td>
</tr>
<tr>
<td colspan = '2'>
<input type = 'submit' value = "Update student" />
</td>
</tr>
</table>
`
는MY ROUTE은 IS Route::post('edit/{id}','[email protected]');
컨트롤러
public function show($id){ $users =User::findOrFail($id); return view('stud_update',['users'=>$users]); } public function edit(Request $request,$id) { dd("welcome"); $name = $request->input('name'); DB::update('update users set name = ? where id = ?',[$name,$id]); echo "Record updated successfully.<br/>"; echo '<a href = "/edit-records">Click Here</a> to go back.'; }
it doesn't diplay the welcome message