If you are using Resource controller then you should use PUT or PATCH method. I have own example. try this –
use this type of code in your blade to make update form –
{!! Form::open(['route' => ['post.update',$value->id], 'files' => true, 'method' => 'post'])!!} {{csrf_field()}} {{method_field('PATCH')}} //Your form code here {!! Form::close() !!}
The route will be like this –
Route::resource('admin/post','PostController');
And the controller code will be like this –
public function edit($id) { $tags = tag::all(); $categories = category::all(); $value = post::with('tags','categories')->where('id',$id)->first(); return view('admin.edit_post',compact('value','tags','categories')); }
Question and answer is powered by AnsPress.io