Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

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.