maximl337
1366
11
Laravel

How to retrieve soft deleted models

Posted 3 years ago by maximl337

How do I get a model, even if its softdeleted?

I want a method, for eg:

public function show($id) {

 // show model event if soft deleted

} 

I tried

App\Model::withTrashed()
                ->where('id', $id)
                ->get();

but it returns a " not found" error. ( not the ModelNotFoundException )

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.