mrsoftware's avatar

What is the difference between destroy() and delete()

What is the difference between destroy() and delete()

please explain to me, when should i use one of them.

0 likes
3 replies
Snapey's avatar
Snapey
Best Answer
Level 122

destroy() takes a key to a model for example destroy($product->id)

delete() is used in two different ways;

a) when you are querying for example Product::where('supplier_id,'=',null)->delete()

b) applied directly to a model for example $product->delete()

4 likes

Please or to participate in this conversation.