I've implemented the SoftDeletes trait in my models, and I want to retrieve soft-deleted records when hitting API endpoints specifically from the admin panel.
However, I don't want these records to be visible to other roles/users.
I've tried using the withTrashed() method in my Eloquent queries, but it's not feasible to write this method in every query.
I'm using the laravel 10.
I'm expecting the global level solution for that.
Because you are providing APIs, I assume you are using an API authentication system such as sanctum.
What about applying a global scope to only show soft deleted models to certain users: