my controller function

public function destroy($id){
    /* Deleting a product */
    Product::destroy($id); // 1 way 
    return redirect()->route('product.index');
}

I tried using both the methods for deleting but it isn't deleting the records in MySQL although it does return with "true"

Is there any configuration am missing?

This is the form using which am initiating the delete..

{!!Form::open([
    'method'=>'delete',
    'route' =>['product.destroy',$product->ID]
])!!}
    <h1>{{$product->name}}</h1> <h3>{{$product->price}}</h3> <a href="#">Edit Product Info</a>
{!!Form::submit('Delete')!!}
{!!Form::close()!!}

Please Help!
Thanks in Advance! Guys!

Recommended Answers

All 4 Replies

Try

Product::find($id)->delete();

Nope no luck! The record is not getting deleted from the table.

Hi,

if you haven't found a solution, could you show the Product model and the table definition?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.