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

skeith22's avatar

How to manually query the soft deleted data

The model is using SoftDeletes trait.

Does anyone know how to manually query the deleted files?

I wanted to query the deleted data without using the withTrashed() or onlyTrashed() functions

0 likes
1 reply
ftrillo's avatar
ftrillo
Best Answer
Level 4

Straight from the docs:

If a model has a non-null deleted_at value, the model has been soft deleted.

So basically this: $query->whereNotNull('deleted_at').

2 likes

Please or to participate in this conversation.