Can you show the route definition and how you call it? Because it sounds that you use call a route with another method then defined in your routes file. Example you do a GET request while the route is defined as POST
I just use this for the routes:
Route::resource('products','ProductController');
And how do you call the route? (And which route?)
here is my edit and update:
public function edit(Product $product)
{
return view('products.edit',compact('product'));
}
public function update(Request $request, Product $product)
{
$this->validate($request, [
'name' => 'required',
'detail' => 'required',
]);
$product->update($request->all());
return redirect()->route('products.index')
->with('success','Product updated successfully');
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community