Support the ongoing development of →
posted 2 years ago
Last updated 1 year ago.

withTrashed returns all soft deleted users. I want all active users, plus the one that's (possibly) soft deleted. This works:

public function scopeActiveOr($query, $id){
    return $query->withTrashed()->where(function($q) use($id){
            ->orWhere('id', $id);

But I'd like to not have to apply SoftDeletes, remove them, then reapply them. I thought there'd be a native solution.

Last updated 2 years ago.

Sign in to participate in this thread!


Your banner here too?

SMills asdf072 Joined 3 Oct 2021


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.