How to get all rows (soft deleted too) from a table in Laravel?

In Laravel, you can use the withTrashed() method to retrieve all the rows, including the soft deleted ones, from a table. For example:

$rows = ModelName::withTrashed()->get();

This will retrieve all the rows, including the soft deleted ones, from the table associated with the ModelName model.

You can also use the onlyTrashed() method to retrieve only the soft deleted rows from a table. For example:

$rows = ModelName::onlyTrashed()->get();

This will retrieve only the soft deleted rows from the table associated with the ModelName model.