Support the ongoing development of Laravel.io →
posted 5 years ago
Last updated 1 year ago.
0
moderator

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

0

I just use this for the routes:

Route::resource('products','ProductController');
0
moderator

And how do you call the route? (And which route?)

Last updated 5 years ago.
0

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');
    }
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.