Fix nested Eloquent queries and softdeletes

Fixes #3403, possibly #3308