Understanding Laravel Eloquent ORM delete() Method

Learn how to use Laravel Eloquent delete() and destroy() methods with clear code examples, soft deletes, and tips that work in the latest Laravel version.

Laravel’s delete() method in Eloquent ORM lets you remove records without writing SQL. It supports single deletes, batch deletes and soft deletes. It’s reliable, simple and works across all modern Laravel versions.

You’ll learn when to use delete(), how it compares to destroy() and forceDelete() and what to watch out for when working with production data.

How delete() Works in Laravel

The delete() method in Laravel is used to permanently remove a record from the database using Eloquent ORM. You call it on a model instance you've already retrieved like User::find(1)->delete()and Laravel handles the SQL behind the scenes. It also fires model events (deleting, deleted) so you can hook into those if needed.

It's the go-to method for deleting single records and works reliably across all Laravel versions. It keeps your code clean avoids raw queries and fits naturally into Laravel’s expressive syntax making it easy for both beginners and experienced developers.

Quick Example: Deleting a Record

Using delete() on a Model Instance

Now let’s say you don’t care about loading the full model and just want it gone maybe you’re deleting by IDs from a list. That’s where destroy() shines
$photo = PhotoGallery::find(5);$photo->delete();

Deleting by ID with destroy()

If you know the primary key(s) and don’t need to load the model first, use destroy()
PhotoGallery::destroy(7);PhotoGallery::destroy([8, 9, 10]); // Delete several at once

How delete(), destroy(), and forceDelete() Differ in Laravel

All three methods remove data, but they work differently:
  • delete() – Used when you already have a model instance. It removes the record and triggers model events like deleting and deleted.
  • destroy() – Lets you delete by primary key(s) without loading the models. It’s faster for batch deletes but skips Eloquent events and logic.
  • forceDelete() – Permanently deletes a record, even if soft deletes are enabled. It bypasses the deleted_at timestamp.
Also Read: The Best Laravel Security Practices For Developers

Soft Deletes in Laravel

Soft deletes allow you to mark a record as deleted without actually removing it from the database. Laravel makes this easy by adding a deleted_at timestamp so you can hide “deleted” records from normal queries but still keep them for recovery or audits.

To enable this add the SoftDeletes trait to your model:

use Illuminate\Database\Eloquent\SoftDeletes; class PhotoGallery extends Model {     use SoftDeletes; }

Other Ways to Delete Records in Laravel

Sometimes you won’t have a single model, like when clearing old logs or failed jobs. In that case, you can add conditions with the query builder and call delete() directly:
FailedJob::where('created_at', '<', now()->subMonth())->delete();
Did you know?

Laravel Idea, built by Adel Faizrakhmanov, is one of the most loved Laravel tools with over 1.5 million downloads on JetBrains Marketplace. It turns PhpStorm into a powerful Laravel-focused IDE that devs actually enjoy using.

Best Practices for Safe and Reliable Data Deletion in Laravel

  • Always review your where clause. One missed condition and you could wipe more data than intended.
  • Use delete() over destroy() if you depend on Eloquent events like deleting or deleted.
  • Go for soft deletes when dealing with user data or anything that might need to be restored later.
  • Avoid deleting in loops. Instead, batch or chunk large deletions to avoid performance hits.
  • Even with soft deletes, back up regularly. Safety nets are great, but backups are better.

Conclusion

Use delete() when you need Eloquent events, destroy() for quick ID-based removal and forceDelete() when you want to skip soft deletes entirely. These three methods give you full control over how records are removed in Laravel.

Pair them with soft deletes, clear where conditions and batch operations for safer, more reliable data handling. Whether you're managing user content or cleaning up large tables these deletion tools help keep your code clean and your database safe even as Laravel evolves.

Related

CORS errors in Laravel usually pop up when your frontend tries talking to a different domain  but the right headers aren’t set. Laravel (v7 and…

10 Oct, 2025

Laravel’s withCount() method lets you directly count related records including only the ones that match specific conditions like status, role or flags without loading the…

07 Oct, 2025

Finding the right Laravel developers can be the difference between a scalable, secure web application and one that struggles to perform. As businesses increasingly rely…

08 Sep, 2025
Request a Quote Schedule a Meeting