Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jred_lewis's avatar

Restoring Soft-Deleted Models

For a personal Laravel project, I'm starting by making an admin panel before the end user view. For at least one model, I'm allowing soft deletes to be used.

I have two opinion-based questions to that end:

  1. For routing should I reuse the included PUT /posts/{post}resource route or make a dedicated PUT route like /posts/{post}/restore to restore the soft-deleted model?

  2. Is restore an acceptable verb in terms of resourceful verbs in the controller? I'm trying to avoid using any non-standard verbs as method names in controllers.

0 likes
1 reply
tykus's avatar

For small, personal projects, PATCH is perfectly acceptable; and in most cases preferrable.

If you wanted, your resource in this case could actually a deleted posts collection, so your action would be to a DeletedPostController, and you could destroy the DeletedPost by restoring it? It's a little mind-bendy, and could be argued that it is not correct resourceful approach, by it is a quirky scenario...

Please or to participate in this conversation.